답안 #9204

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
9204 2014-09-28T04:38:07 Z myungwoo On grid (kriii2_O) C++14
4 / 4
96 ms 2504 KB
#include <stdio.h>

int N, M;
int A[301][301], S[301][301], D[301][301], V[301][301];

int main()
{
	int i, j, k;
	scanf("%d%d", &N, &M);
	for (i=1;i<=N;i++) for (j=1;j<=M;j++) scanf("%d", A[i]+j), S[i][j] = A[i][j]+S[i-1][j]+S[i][j-1]-S[i-1][j-1];
	for (i=0;i<=N;i++) for (j=0;j<=N;j++) V[i][j] = -1e9;
	for (j=1;j<=M;j++) for (i=N;i;i--){
		D[i][j] = S[i][j];
		for (int a=0;a<i;a++){
			if (V[a][i] > -1e9 && D[i][j] < V[a][i]+S[i][j]-S[a][j])
				D[i][j] = V[a][i]+S[i][j]-S[a][j];
		}
		for (int a=i+1;a<=N;a++){
			if (V[i][a] < D[i][j]-S[a][j]+S[i][j])
				V[i][a] = D[i][j]-S[a][j]+S[i][j];
		}
	}
	printf("%d\n", D[N][M]);
}
# 결과 실행 시간 메모리 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 20 ms 2504 KB Output is correct
2 Correct 12 ms 2504 KB Output is correct
3 Correct 32 ms 2504 KB Output is correct
4 Correct 24 ms 2504 KB Output is correct
5 Correct 8 ms 2504 KB Output is correct
6 Correct 40 ms 2504 KB Output is correct
7 Correct 20 ms 2504 KB Output is correct
8 Correct 60 ms 2504 KB Output is correct
9 Correct 96 ms 2504 KB Output is correct
10 Correct 96 ms 2504 KB Output is correct
11 Correct 20 ms 2504 KB Output is correct
12 Correct 20 ms 2504 KB Output is correct
13 Correct 12 ms 2504 KB Output is correct
14 Correct 60 ms 2504 KB Output is correct
15 Correct 20 ms 2504 KB Output is correct
16 Correct 12 ms 2504 KB Output is correct
17 Correct 28 ms 2504 KB Output is correct
18 Correct 28 ms 2504 KB Output is correct
19 Correct 28 ms 2504 KB Output is correct
20 Correct 8 ms 2504 KB Output is correct
21 Correct 12 ms 2504 KB Output is correct
22 Correct 8 ms 2504 KB Output is correct
23 Correct 12 ms 2504 KB Output is correct
24 Correct 60 ms 2504 KB Output is correct
25 Correct 8 ms 2504 KB Output is correct
26 Correct 8 ms 2504 KB Output is correct
27 Correct 60 ms 2504 KB Output is correct
28 Correct 24 ms 2504 KB Output is correct
29 Correct 12 ms 2504 KB Output is correct
30 Correct 12 ms 2504 KB Output is correct
31 Correct 24 ms 2504 KB Output is correct
32 Correct 72 ms 2504 KB Output is correct
33 Correct 36 ms 2504 KB Output is correct
34 Correct 12 ms 2504 KB Output is correct
35 Correct 16 ms 2504 KB Output is correct
36 Correct 96 ms 2504 KB Output is correct
37 Correct 20 ms 2504 KB Output is correct
38 Correct 20 ms 2504 KB Output is correct
39 Correct 16 ms 2504 KB Output is correct
40 Correct 16 ms 2504 KB Output is correct