Submission #83446

# Submission time Handle Problem Language Result Execution time Memory
83446 2018-11-07T19:24:37 Z Qlukva Bali Sculptures (APIO15_sculpture) C++14
0 / 100
2 ms 644 KB
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

const int INF = 1.5e9;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n, a, b;
	cin >> n >> a >> b;
	vector<int> x(n + 1);
	for (int i = 1; i <= n; i++) {
		cin >> x[i];
	}
	vector<vector<int>> d(b + 1, vector<int>(n + 1, INF));
	d[0][0] = 0;
	for (int j = 1; j <= b; j++) {
		for (int i = 1; i <= n; i++) {
			int cur = x[i];
			for (int k = i - 1; k >= 0; k--) {
				d[j][i] = min(d[j][i], (d[j - 1][k] | cur));
				cur += x[k];
			}
		}
	}
	int ans = INF;
	for (int i = a; i <= b; i++) {
		ans = min(ans, d[i][n]);
	}
	cout << ans << endl;
//	system("pause");
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 468 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 468 KB Output is correct
2 Incorrect 2 ms 596 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 596 KB Output is correct
2 Incorrect 2 ms 604 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 616 KB Output is correct
2 Incorrect 2 ms 616 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 644 KB Output is correct
2 Incorrect 2 ms 644 KB Output isn't correct
3 Halted 0 ms 0 KB -