#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2005;
int n, x, y;
ll a[N], dp[N][N];
int main(){
cin >> n >> x >> y;
for (int i = 1; i <= n; i ++)
cin >> a[i], a[i] += a[i - 1];
for (int i = 1; i <= n; i ++){
for (int j = 1; j <= i; j ++){
if (j == 1){
dp[i][j] = a[i];
continue;
}
dp[i][j] = 1e18;
for (int k = j - 1; k < i; k ++)
dp[i][j] = min(dp[i][j], dp[k][j - 1] | (a[i] - a[k]));
}
}
ll ans = 1e18;
for (int i = x; i <= y; i ++)
ans = min(ans, dp[n][i]);
cout << ans << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |