# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
676469 | penguin133 | Orchard (NOI14_orchard) | C++17 | 191 ms | 10060 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;
int main(){
int r,c;
cin >> r >> c;
int g[r][c];
long long a=0,b=0;
string s;
for(int i=0;i<r;i++){
for(int j=0;j<c;j++){
cin >> g[i][j];
if(g[i][j] == 1){
b++;
}
else{
g[i][j] = -1;
}
}
}
long long cnt= 0;
long long maxi = 0;
int d = -1;
int e = -1;
int d1=-1, e1 = -1;
long long mini = 1e18 + 5;
for(int i=0;i<r;i++){
int cnt2[c];
for(int x=0;x<c;x++){
cnt2[x] = g[i][x];
}
for(int j=i;j<r;j++){
if(j != i){
for(int x=0;x<c;x++){
cnt2[x] += g[j][x];
}
}
cnt = 0;
for(int k=0;k<c;k++){
cnt += cnt2[k];
if(cnt > maxi){
maxi = cnt;
}
if(cnt < 0){
cnt = 0;
}
}
}
}
cout << b - maxi;
}
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... |