#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
const int maxn = 2005;
ll dp[maxn][maxn], sum[maxn];
int main(int argc, char const *argv[]) {
#ifdef LOCAL_TESTING
freopen("in", "r", stdin);
#endif
int n, a, b;
cin >> n >> a >> b;
for(int i = 1; i <= n; i++) {
cin >> sum[i]; sum[i] += sum[i-1];
}
for(int i = 0; i <= n; i++)
dp[0][i] = sum[i];
for(int k = 1; k < b; k++) {
for(int i = 1; i <= n; i++) {
dp[k][i] = 1e18;
for(int j = 0; j < i; j++) {
dp[k][i] = min(dp[k][i], dp[k - 1][j] | (sum[i] - sum[j]));
}
}
}
ll Min = 1e18;
for(int i = a-1; i < b; i++)
Min = min(Min, dp[i][n]);
cout << Min << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
33436 KB |
Output is correct |
2 |
Incorrect |
0 ms |
33436 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
33436 KB |
Output is correct |
2 |
Incorrect |
0 ms |
33436 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
33436 KB |
Output is correct |
2 |
Incorrect |
0 ms |
33436 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
33436 KB |
Output is correct |
2 |
Incorrect |
0 ms |
33436 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
33436 KB |
Output is correct |
2 |
Incorrect |
0 ms |
33436 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |