Why is this code not getting fully accepted for all ones

#include
using namespace std;
int main()
{
int row;
int col;
cin>>row>>col;
int dp[row][col];
int cost[row][col];
for(int i=0;i<row;i++)
{
for(int j=0;j<col;j++)
{
cin>>cost[i][j];
}
}
int max=0;
for(int i=0;i<row;i++)
{
dp[i][0]=cost[i][0];
}
for(int j=0;j<col;j++)
{
dp[0][j]=cost[0][j];
}
for(int i=1;i<row;i++)
{
for(int j=1;j<col;j++)
{
if(cost[i][j]==0)
{
dp[i][j]=0;
}
else if(dp[i-1][j]>0 && dp[i][j-1]>0 && dp[i-1][j-1]>0)
{
dp[i][j]=1+min((dp[i-1][j],dp[j][i-1]),dp[i-1][j-1]);
}
else
{
dp[i][j]=1;
}
if(dp[i][j]>max)
{
max=dp[i][j];
}
}
}
cout<<max;
}

@praritv1
Your code is incorrect
Have a look at this https://www.geeksforgeeks.org/maximum-size-sub-matrix-with-all-1s-in-a-binary-matrix/
Also please send code on CB IDE
We can’t run and debug your code if you paste it here directly

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.