# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
824636 |
2023-08-14T08:26:37 Z |
exodus_ |
Orchard (NOI14_orchard) |
C++14 |
|
373 ms |
8152 KB |
#include<bits/stdc++.h>
using namespace std;
int orch[155][5005];
int main() {
int r,c;
int hitone=0;
cin >> r >> c;
for(int i=1; i<=r; i++) {
for(int j=1; j<=c; j++) {
cin >> orch[i][j];
if(orch[i][j]==1) hitone++;
}
}
int answer = hitone;
int ter, sum;
vector<int>co(c+1);
for(int i=1; i<=r; i++) {
for(int k=1; k<=c; k++) {
co[k]=0;
}
for(int j=i; j<=r; j++) {
sum = 0;
ter = 0;
for(int kol=1; kol<=c; kol++) {
if(orch[j][kol]) {
sum-=1;
} else {
sum+=1;
}
co[kol]+=sum;
answer = min(answer, hitone+co[kol]-ter);
ter = max(ter, co[kol]);
}
}
}
cout << answer << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
304 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
448 KB |
Output is correct |
3 |
Correct |
4 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
101 ms |
8152 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
24 ms |
1428 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
724 KB |
Output is correct |
2 |
Correct |
12 ms |
1044 KB |
Output is correct |
3 |
Correct |
10 ms |
980 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
372 ms |
4712 KB |
Output is correct |
2 |
Correct |
373 ms |
4712 KB |
Output is correct |
3 |
Correct |
362 ms |
4680 KB |
Output is correct |