답안 #9344

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
9344 2014-09-28T05:44:27 Z hodduc On grid (kriii2_O) C++
1 / 4
1000 ms 2504 KB
#include<stdio.h>
int R, C;
int map[301][301];
int s[301][301];
int d[301][301];
int dd[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 = 0;
			for(int k = 1; k < i; k++)
			{
				for(int p = 1; p < j; p++)
				{
					int tmp = dd[k][p] - s[k][j] - s[i][p];
					if(tt < tmp) tt = tmp;
				}
			}
			d[i][j] = tt + s[i][j];
			dd[i][j] = d[i][j] + s[i][j];
		}
	}
	printf("%d\n", d[R][C]);
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2504 KB Output is correct
2 Correct 0 ms 2504 KB Output is correct
3 Correct 0 ms 2504 KB Output is correct
4 Correct 0 ms 2504 KB Output is correct
5 Correct 0 ms 2504 KB Output is correct
6 Correct 0 ms 2504 KB Output is correct
7 Correct 0 ms 2504 KB Output is correct
8 Correct 0 ms 2504 KB Output is correct
9 Correct 0 ms 2504 KB Output is correct
10 Correct 0 ms 2504 KB Output is correct
11 Correct 0 ms 2504 KB Output is correct
12 Correct 0 ms 2504 KB Output is correct
13 Correct 0 ms 2504 KB Output is correct
14 Correct 0 ms 2504 KB Output is correct
15 Correct 0 ms 2504 KB Output is correct
16 Correct 0 ms 2504 KB Output is correct
17 Correct 0 ms 2504 KB Output is correct
18 Correct 0 ms 2504 KB Output is correct
19 Correct 0 ms 2504 KB Output is correct
20 Correct 0 ms 2504 KB Output is correct
21 Correct 0 ms 2504 KB Output is correct
22 Correct 0 ms 2504 KB Output is correct
23 Correct 0 ms 2504 KB Output is correct
24 Correct 0 ms 2504 KB Output is correct
25 Correct 0 ms 2504 KB Output is correct
26 Correct 0 ms 2504 KB Output is correct
27 Correct 0 ms 2504 KB Output is correct
28 Correct 0 ms 2504 KB Output is correct
29 Correct 0 ms 2504 KB Output is correct
30 Correct 0 ms 2504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 268 ms 2504 KB Output is correct
2 Correct 100 ms 2504 KB Output is correct
3 Correct 436 ms 2504 KB Output is correct
4 Correct 248 ms 2504 KB Output is correct
5 Correct 108 ms 2504 KB Output is correct
6 Correct 820 ms 2504 KB Output is correct
7 Correct 248 ms 2504 KB Output is correct
8 Execution timed out 1000 ms 2504 KB Program timed out
9 Halted 0 ms 0 KB -