이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |