Help me solving this question

not able solve code:
#include
using namespace std;

int main() {
int r,c;
cin>>r>>c;
int land[r][c];
for(int i=0;i<r;i++){
for(int j=0;j<c;j++){
cin>>land[i][j];
}
}
int dp[r+1][c+1];
for(int i=0;i<=r;i++){
for(int j=0;j<=c;j++){
dp[i][j] = 0;
}
}

for(int i=1;i<=r;i++){
	for(int j=1;j<=c;j++){
		dp[i][j] = max(dp[i-1][j],dp[i][j-1])+land[i-1][j-1];
	}
}
cout<<dp[r][c];
return 0;

}

The problem can be reduced to finding the maximum rectangle area in a histogram, multiple times.

After each row, you calculate the histogram built until that row, and that calculate the maximum area rectangle in that histogram.

For better understanding , refer this -:

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.