Submission #8842

# Submission time Handle Problem Language Result Execution time Memory
8842 2014-09-21T10:47:37 Z gs13068 On grid (kriii2_O) C++
0 / 4
0 ms 108320 KB
#include<cstdio>
#include<algorithm>

int a[301][301];
int t[301][301];
int d[301][301][301];

int main()
{
	int i,j,k,l,n,m;
	scanf("%d%d",&n,&m);
	for(i=1;i<=n;i++)for(j=1;j<=m;j++)
	{
		scanf("%d",&a[i][j]);
        a[i][j]+=a[i-1][j]+a[i][j-1]-a[i-1][j-1];
        t[i][j]=-1e9;
        for(k=0;k<j;k++)
		{
			d[i][j][k]=std::max(d[i-1][j][k],t[i-1][k])+a[i][j]-a[i-1][j]-a[i][k]+a[i-1][k];
			t[i][j]=std::max(t[i][j],d[i][j][k]);
		}
	}
	printf("%d",t[n][m]);
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 108320 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -