# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
9388 |
2014-09-28T06:03:54 Z |
hodduc |
On grid (kriii2_O) |
C++ |
|
48 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 tr[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 kk = 1; kk < i; kk++)
tr[kk] = -1999999999;
for(int j = 1; j <= C; j++)
{
int tt = 0;
for(int k = 1; k < i; k++)
{
if(tt < tr[k] - s[k][j]) tt = tr[k] - s[k][j];
int tmp = (dd[k][j] - s[i][j]);
if(tr[k] < tmp) tr[k] = 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;
}
# |
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 |
4 ms |
2504 KB |
Output is correct |
2 |
Correct |
4 ms |
2504 KB |
Output is correct |
3 |
Correct |
16 ms |
2504 KB |
Output is correct |
4 |
Correct |
8 ms |
2504 KB |
Output is correct |
5 |
Correct |
4 ms |
2504 KB |
Output is correct |
6 |
Correct |
20 ms |
2504 KB |
Output is correct |
7 |
Correct |
12 ms |
2504 KB |
Output is correct |
8 |
Correct |
28 ms |
2504 KB |
Output is correct |
9 |
Correct |
48 ms |
2504 KB |
Output is correct |
10 |
Correct |
44 ms |
2504 KB |
Output is correct |
11 |
Correct |
8 ms |
2504 KB |
Output is correct |
12 |
Correct |
12 ms |
2504 KB |
Output is correct |
13 |
Correct |
4 ms |
2504 KB |
Output is correct |
14 |
Correct |
32 ms |
2504 KB |
Output is correct |
15 |
Correct |
12 ms |
2504 KB |
Output is correct |
16 |
Correct |
4 ms |
2504 KB |
Output is correct |
17 |
Correct |
16 ms |
2504 KB |
Output is correct |
18 |
Correct |
16 ms |
2504 KB |
Output is correct |
19 |
Correct |
16 ms |
2504 KB |
Output is correct |
20 |
Correct |
0 ms |
2504 KB |
Output is correct |
21 |
Correct |
8 ms |
2504 KB |
Output is correct |
22 |
Correct |
4 ms |
2504 KB |
Output is correct |
23 |
Correct |
8 ms |
2504 KB |
Output is correct |
24 |
Correct |
32 ms |
2504 KB |
Output is correct |
25 |
Correct |
4 ms |
2504 KB |
Output is correct |
26 |
Correct |
4 ms |
2504 KB |
Output is correct |
27 |
Correct |
36 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 |
8 ms |
2504 KB |
Output is correct |
31 |
Correct |
16 ms |
2504 KB |
Output is correct |
32 |
Correct |
44 ms |
2504 KB |
Output is correct |
33 |
Correct |
20 ms |
2504 KB |
Output is correct |
34 |
Correct |
8 ms |
2504 KB |
Output is correct |
35 |
Correct |
4 ms |
2504 KB |
Output is correct |
36 |
Correct |
44 ms |
2504 KB |
Output is correct |
37 |
Correct |
8 ms |
2504 KB |
Output is correct |
38 |
Correct |
4 ms |
2504 KB |
Output is correct |
39 |
Correct |
8 ms |
2504 KB |
Output is correct |
40 |
Correct |
8 ms |
2504 KB |
Output is correct |