# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
10102 |
2014-10-15T06:13:19 Z |
gs14030 |
On grid (kriii2_O) |
C++ |
|
1000 ms |
1464 KB |
#include <cstdio>
int n,m,gs[310][310];
int koi(int a,int b)
{
int x=0,y=0;
if(a==n){ for(int i=b; i<=m; i++) x+=gs[a][i]; return x; }
if(b==m){ for(int i=a; i<=n; i++) x+=gs[i][b]; return x; }
for(int i=a; i<=n; i++)
for(int j=b; j<=m; j++) y+=gs[i][j];
for(int i=a; i<n; i++)
for(int j=b; j<m; j++)
{
x=0;
for(int p=a; p<=i; p++)
for(int q=b; q<=j; q++) x+=gs[p][q];
x+=koi(i+1,j+1);
if(y<x) y=x;
}
return y;
}
int main()
{
scanf("%d%d",&n,&m);
for(int i=1; i<=n; i++)
for(int j=1; j<=m; j++) scanf("%d",&gs[i][j]);
printf("%d",koi(1,1));
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1464 KB |
Output is correct |
2 |
Correct |
0 ms |
1464 KB |
Output is correct |
3 |
Correct |
0 ms |
1464 KB |
Output is correct |
4 |
Execution timed out |
1000 ms |
1460 KB |
Program timed out |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |