# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
9205 |
2014-09-28T04:39:08 Z |
myungwoo |
On grid (kriii2_O) |
C++14 |
|
92 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 (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]);
}
# |
Verdict |
Execution time |
Memory |
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 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
16 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 |
12 ms |
2504 KB |
Output is correct |
8 |
Correct |
52 ms |
2504 KB |
Output is correct |
9 |
Correct |
92 ms |
2504 KB |
Output is correct |
10 |
Correct |
88 ms |
2504 KB |
Output is correct |
11 |
Correct |
16 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 |
56 ms |
2504 KB |
Output is correct |
15 |
Correct |
16 ms |
2504 KB |
Output is correct |
16 |
Correct |
12 ms |
2504 KB |
Output is correct |
17 |
Correct |
32 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 |
8 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 |
52 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 |
52 ms |
2504 KB |
Output is correct |
28 |
Correct |
16 ms |
2504 KB |
Output is correct |
29 |
Correct |
8 ms |
2504 KB |
Output is correct |
30 |
Correct |
12 ms |
2504 KB |
Output is correct |
31 |
Correct |
20 ms |
2504 KB |
Output is correct |
32 |
Correct |
68 ms |
2504 KB |
Output is correct |
33 |
Correct |
28 ms |
2504 KB |
Output is correct |
34 |
Correct |
8 ms |
2504 KB |
Output is correct |
35 |
Correct |
16 ms |
2504 KB |
Output is correct |
36 |
Correct |
92 ms |
2504 KB |
Output is correct |
37 |
Correct |
16 ms |
2504 KB |
Output is correct |
38 |
Correct |
16 ms |
2504 KB |
Output is correct |
39 |
Correct |
16 ms |
2504 KB |
Output is correct |
40 |
Correct |
8 ms |
2504 KB |
Output is correct |