Submission #124578

# Submission time Handle Problem Language Result Execution time Memory
124578 2019-07-03T14:19:14 Z streifi Orchard (NOI14_orchard) C++14
0 / 25
1000 ms 6228 KB
#include <iostream>
#include <vector>
using namespace std;

const int INF = 0x3f3f3f3f;

signed main() {
	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 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1069 ms 2388 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1064 ms 6228 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1057 ms 3220 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1060 ms 2348 KB Time limit exceeded
2 Halted 0 ms 0 KB -