#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
const long long INF = 1e15;
int main() {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n, a, b;
cin >> n >> a >> b;
vector<long long> x(n + 1);
for (int i = 1; i <= n; i++) {
cin >> x[i];
}
vector<vector<long long>> d(b + 1, vector<long long>(n + 1, INF));
d[0][0] = 0;
for (int j = 1; j <= b; j++) {
for (int i = 1; i <= n; i++) {
long long 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];
}
}
}
long long 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 |
472 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
472 KB |
Output is correct |
2 |
Incorrect |
2 ms |
472 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
516 KB |
Output is correct |
2 |
Incorrect |
2 ms |
516 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
516 KB |
Output is correct |
2 |
Incorrect |
2 ms |
516 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
520 KB |
Output is correct |
2 |
Incorrect |
2 ms |
592 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |