Submission #124611

# Submission time Handle Problem Language Result Execution time Memory
124611 2019-07-03T15:03:26 Z streifi Orchard (NOI14_orchard) C++14
8 / 25
1000 ms 4216 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> cum(M+2, 0);
	for (int m = 0; m < M; ++m) {
		int X;
		cin >> X;
		cum[m+1] = cum[m]+X;
	}
	cum[M+1] = cum[M];
	int fee = INF;
	for (int i = 0; i <= M; ++i) {
		for (int j = i+1; j <= M+1; ++j) {
			int a = cum[i];
			int b = (j-i)-(cum[j]-cum[i]);
			//cout << b << endl;
			int c = cum[M+1]-cum[j];
			fee = min(fee, a+b+c);
		}
	}
	cout << fee << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 180 ms 448 KB Output is correct
2 Correct 178 ms 376 KB Output is correct
3 Correct 178 ms 476 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1056 ms 4216 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1068 ms 760 KB Time limit exceeded
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 22 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -