# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
125984 |
2019-07-06T16:00:51 Z |
streifi |
Orchard (NOI14_orchard) |
C++14 |
|
83 ms |
10104 KB |
#include <iostream>
#include <vector>
using namespace std;
const int INF = 0x3f3f3f3f;
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
int N, M;
cin >> N >> M;
vector<int> v(M), cum(M+1, 0);
for (int m = 0; m < M; ++m) {
cin >> v[m];
if (v[m] == 0) v[m] = -1;
cum[m+1] = cum[m]+v[m];
}
int mxpos = M;
int best = INF;
for (int m = M; m > 0; --m) {
int cur = (M-mxpos)+(cum[M]-cum[mxpos]) + (mxpos-m)-(cum[mxpos]-cum[m]) + m + cum[m];
best = min(best, cur);
}
cout << best << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
504 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
83 ms |
10104 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
1636 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |