# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
78666 | thebes | Orchard (NOI14_orchard) | C++14 | 231 ms | 13604 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int MN = 155;
int ans[MN][MN], n, m, i, j, k, x, y, tot, opt;
bitset<100005> arr[MN];
int main(){
for(scanf("%d%d",&n,&m),i=1;i<=n;i++){
for(j=1;j<=m;j++){
scanf("%d",&x);
arr[i][j] = (x);
if(x) tot++;
}
}
for(i=1;i<=m;i++){
for(j=1;j<=n;j++){
int tmp = 0;
for(k=j;k<=n;k++){
tmp+=(arr[k][i])? 1:-1;
ans[j][k]=max(ans[j][k]+tmp,0);
opt = max(opt, ans[j][k]);
}
}
}
printf("%d\n",tot-opt);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |