# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
9364 |
2014-09-28T05:56:10 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] = -199999999;
for(int pp = 1; pp <= C; pp++)
{
int tmp = (dd[kk][pp] - s[i][pp]);
if(tr[kk] < tmp) tr[kk] = tmp;
}
}
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];
}
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 |
Incorrect |
0 ms |
2504 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |