Submission #13151

#TimeUsernameProblemLanguageResultExecution timeMemory
13151paulsohnOrchard (NOI14_orchard)C++98
12 / 25
303 ms204596 KiB
#include<stdio.h> #include<algorithm> using namespace std; int n, m, V[160][2010], sum[160][2010], dy[160][160][2010]; int main(){ int i,ii,j,tmp,tot=0,wei=50000000; scanf("%d %d",&n,&m); for(i=1;i<=n;++i){ for(j=1;j<=m;++j){ scanf("%d",&tmp); if(tmp){ ++tot; V[i][j]=-1; } else V[i][j]=1; sum[i][j]=V[i][j]+sum[i-1][j]; } } for(i=0;i<n;++i){ for(ii=i+1;ii<=n;++ii){ for(j=1;j<=m;++j){ dy[i][ii][j]=sum[ii][j]-sum[i][j]+min(dy[i][ii][j-1],0); wei=min(wei,dy[i][ii][j]); } } } printf("%d\n",tot+wei); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...