Submission #9338

# Submission time Handle Problem Language Result Execution time Memory
9338 2014-09-28T05:39:23 Z hodduc On grid (kriii2_O) C++
1 / 4
1000 ms 2148 KB
#include<stdio.h>r
int R, C;
int map[301][301];
int s[301][301];
int d[301][301];
int main()
{
	scanf("%d %d", &R, &C);
	for(int i = 1; i <= R; i++) for(int j = 1; j <= C; j++){
		scanf("%d", &map[i][j]);
	}

	for(int i = 1; i <= R; i++){
		int t = 0;
		for(int j = 1; j <= C; j++){
			t += map[i][j];
			s[i][j] = s[i-1][j] + t;
		}
	}

	for(int i = 1; i <= R; i++)
	{
		for(int j = 1; j <= C; j++)
		{
			int tt = s[i][j];
			for(int k = 1; k < i; k++)
			{
				for(int p = 1; p < j; p++)
				{
					int tmp = d[k][p] + (s[i][j] - s[k][j] - s[i][p] + s[k][p]);
					if(tt < tmp) tt = tmp;
				}
			}
			d[i][j] = tt;
		}
	}
	printf("%d\n", d[R][C]);
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2148 KB Output is correct
2 Correct 0 ms 2148 KB Output is correct
3 Correct 0 ms 2148 KB Output is correct
4 Correct 0 ms 2148 KB Output is correct
5 Correct 0 ms 2148 KB Output is correct
6 Correct 0 ms 2148 KB Output is correct
7 Correct 0 ms 2148 KB Output is correct
8 Correct 0 ms 2148 KB Output is correct
9 Correct 0 ms 2148 KB Output is correct
10 Correct 0 ms 2148 KB Output is correct
11 Correct 0 ms 2148 KB Output is correct
12 Correct 0 ms 2148 KB Output is correct
13 Correct 0 ms 2148 KB Output is correct
14 Correct 0 ms 2148 KB Output is correct
15 Correct 0 ms 2148 KB Output is correct
16 Correct 0 ms 2148 KB Output is correct
17 Correct 0 ms 2148 KB Output is correct
18 Correct 0 ms 2148 KB Output is correct
19 Correct 0 ms 2148 KB Output is correct
20 Correct 0 ms 2148 KB Output is correct
21 Correct 0 ms 2148 KB Output is correct
22 Correct 0 ms 2148 KB Output is correct
23 Correct 0 ms 2148 KB Output is correct
24 Correct 0 ms 2148 KB Output is correct
25 Correct 0 ms 2148 KB Output is correct
26 Correct 0 ms 2148 KB Output is correct
27 Correct 0 ms 2148 KB Output is correct
28 Correct 0 ms 2148 KB Output is correct
29 Correct 0 ms 2148 KB Output is correct
30 Correct 0 ms 2148 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 340 ms 2148 KB Output is correct
2 Correct 124 ms 2148 KB Output is correct
3 Correct 548 ms 2148 KB Output is correct
4 Correct 304 ms 2148 KB Output is correct
5 Correct 144 ms 2148 KB Output is correct
6 Execution timed out 1000 ms 2148 KB Program timed out
7 Halted 0 ms 0 KB -