Submission #16508

# Submission time Handle Problem Language Result Execution time Memory
16508 2015-08-27T00:08:21 Z hongjun7 On grid (kriii2_O) C++
0 / 4
0 ms 1808 KB
#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
1 Incorrect 0 ms 1808 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -