Submission #48149

# Submission time Handle Problem Language Result Execution time Memory
48149 2018-05-10T10:39:10 Z square1001 Bali Sculptures (APIO15_sculpture) C++14
0 / 100
2 ms 640 KB
#include <vector>
#include <cassert>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int N, A, B;
	cin >> N >> A >> B;
	assert(A == 1);
	vector<int> v(N);
	for (int i = 0; i < N; i++) cin >> v[i];
	long long ret = 0;
	for (int i = 40; i >= 0; i--) {
		vector<int> dp(N + 1, 1 << 30);
		dp[0] = 0;
		for (int j = 1; j <= N; j++) {
			long long cur = 0;
			for (int k = j - 1; k >= 0; k--) {
				cur += v[k];
				if (((cur >> (i + 1)) | ret) == ret && !((cur >> i) & 1)) {
					dp[j] = min(dp[j], dp[k]);
				}
			}
		}
		ret <<= 1;
		if (dp[N] > B) ret++;
	}
	cout << ret << '\n';
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 484 KB Output is correct
3 Correct 2 ms 484 KB Output is correct
4 Correct 2 ms 484 KB Output is correct
5 Incorrect 2 ms 488 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 488 KB Output is correct
2 Correct 2 ms 500 KB Output is correct
3 Correct 2 ms 640 KB Output is correct
4 Correct 2 ms 640 KB Output is correct
5 Incorrect 2 ms 640 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 640 KB Output is correct
2 Correct 2 ms 640 KB Output is correct
3 Correct 2 ms 640 KB Output is correct
4 Correct 2 ms 640 KB Output is correct
5 Incorrect 2 ms 640 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 640 KB Output is correct
2 Correct 2 ms 640 KB Output is correct
3 Correct 2 ms 640 KB Output is correct
4 Correct 2 ms 640 KB Output is correct
5 Incorrect 2 ms 640 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 640 KB Output is correct
2 Correct 2 ms 640 KB Output is correct
3 Correct 2 ms 640 KB Output is correct
4 Correct 2 ms 640 KB Output is correct
5 Incorrect 2 ms 640 KB Output isn't correct
6 Halted 0 ms 0 KB -