#include <bits/stdc++.h>
#define int long long
#define see(x) cout<<#x<<"="<<x<<endl;
#define endl "\n"
using namespace std;
const int N = 2*1e5+5;
const int INF = 1e18;
int n, a, b, y[105];
int dp[105][105], pref[105];
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
/*
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
*/
cin >> n >> a >> b;
for (int i = 1; i <= n; i ++) {
cin >> y[i];
pref[i] = pref[i-1] + y[i];
}
for (int i = 1; i <= n; i ++) {
dp[i][1] = pref[i];
for (int j = 2; j <= b; j ++) {
dp[i][j] = INF;
for (int k = 1; k < i; k ++) {
dp[i][j] = min(dp[i][j], (dp[k][j-1] | (pref[i] - pref[k])));
}
}
}
int res = INF;
for (int i = a; i <= b; i ++) {
res = min(res, dp[n][i]);
}
cout << res << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |