# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
9371 |
2014-09-28T05:59:40 Z |
hodduc |
On grid (kriii2_O) |
C++ |
|
0 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++)
{
int tmp = (dd[k][j] - s[i][j]);
if(tr[k] < tmp) tr[k] = tmp;
if(tt < tr[k] - s[k][j]) tt = tr[k] - s[k][j];
}
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 |
Incorrect |
0 ms |
2504 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |