# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
9738 |
2014-09-28T08:33:01 Z |
YesUjam |
On grid (kriii2_O) |
C++ |
|
0 ms |
2176 KB |
#include<stdio.h>
#define M 305
int t[M][M],sum[M][M],a[M][M];
int main()
{
int i,j,k,w,n,m;
scanf("%d %d",&n,&m);
for(i=1;i<=n;i++){
for(j=1;j<=m;j++){
scanf("%d",&a[i][j]);
sum[i][j]+=sum[i][j-1]+a[i][j];
t[i][j]=sum[i][j];
}
for(j=1;j<=m;j++){
sum[i][j]+=sum[i-1][j];
}
}
for(i=2;i<=n;i++){
for(j=2;j<=m;j++){
for(k=1;k<i;k++){
for(w=1;w<i;w++){
if(t[i][j]<t[k][w]+(sum[i][j]-sum[k][j]-sum[i][w]+sum[k][w])){
t[i][j]=t[k][w]+(sum[i][j]-sum[k][j]-sum[i][w]+sum[k][w]);
}
}
}
}
}
printf("%d\n",t[n][m]);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
2176 KB |
Output is correct |
2 |
Incorrect |
0 ms |
2176 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |