#include <bits/stdc++.h>
using namespace std;
#define MAXN 2003
typedef long long lld;
int N, A, B;
int X[MAXN];
lld D[MAXN][MAXN];
int main()
{
scanf("%d%d%d", &N, &A, &B);
for (int i=1;i<=N;i++) scanf("%d", X+i);
for (int i=1;i<=N;i++) D[1][i] = D[1][i-1] + X[i];
for (int i=2;i<=B;i++){
for (int j=i;j<=N;j++){
D[i][j] = 1e18;
for (int k=j-1;k>=i-1;k--){
D[i][j] = min(D[i][j], D[i-1][k] | (D[1][j] - D[1][k]));
}
}
}
lld ans = 1e18;
for (int i=A;i<=B;i++) ans = min(ans, D[i][N]);
printf("%lld\n", ans);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
33072 KB |
Output is correct |
2 |
Incorrect |
0 ms |
33072 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
33072 KB |
Output is correct |
2 |
Incorrect |
0 ms |
33072 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
33072 KB |
Output is correct |
2 |
Incorrect |
0 ms |
33072 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
33072 KB |
Output is correct |
2 |
Incorrect |
0 ms |
33072 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
33072 KB |
Output is correct |
2 |
Incorrect |
0 ms |
33072 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |