Submission #9738

#TimeUsernameProblemLanguageResultExecution timeMemory
9738YesUjamOn grid (kriii2_O)C++98
0 / 4
0 ms2176 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...