This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
#define MN 305
int n, m, x, c[MN][MN], d[MN][MN], v;
int main() {
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
scanf("%d", &x);
c[i][j] = x + c[i - 1][j] + c[i][j - 1] - c[i - 1][j - 1];
for (int k = 1; k <= i; k++) {
for (int l = 1; l <= j; l++) {
v = d[k - 1][l - 1] + c[i][j] - c[i][l - 1] - c[k - 1][j] + c[k - 1][l - 1];
if (v > d[i][j]) d[i][j] = v;
}
}
}
}
printf("%d", d[n][m]);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |