#include <bits/stdc++.h>
#define FOR(i, x, y) for (int i = x; i < y; i++)
typedef long long ll;
using namespace std;
ll s[2001], pref[2001], dp1[2001][2001], dp2[101][101];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, a, b;
cin >> n >> a >> b;
FOR(i, 1, n + 1) {
cin >> s[i];
pref[i] = pref[i - 1] + s[i];
}
// if (a == 1) {
// } else {
FOR(i, 1, n + 1) dp2[i][0] = INT_MAX;
dp2[0][0] = 0;
FOR(i, 1, n + 1) {
FOR(j, 1, i + 1) {
dp2[i][j] = INT_MAX;
FOR(k, j - 1, i) {
dp2[i][j] = min(dp2[i][j], dp2[k][j - 1] | (pref[i] - pref[k]));
}
}
}
ll ans = INT_MAX;
FOR(i, a, b + 1) ans = min(ans, dp2[n][i]);
cout << ans;
// }
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |