Submission #16508

#TimeUsernameProblemLanguageResultExecution timeMemory
16508hongjun7On grid (kriii2_O)C++98
0 / 4
0 ms1808 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...