#include <bits/stdc++.h>
using namespace std;
const int N = 2002;
int Arr[N],pre[N];
int dp[N][N];
int main()
{
ios_base::sync_with_stdio(false);
int n,a,b;
cin >> n >> a >> b;
for(int i =1;i<=n;i++) cin >> Arr[i];
for(int i =1;i<=n;i++) {
pre[i] = pre[i-1] + Arr[i];
}
for(int i=1;i<=n;i++) dp[0][i] = pre[i];
for(int i =1;i<=b;i++) {
for(int j =1;j<=n;j++) {
dp[i][j] = 2e9;
for(int s = j-1;s>0;s--) {
dp[i][j] = min(dp[i][j],(pre[j] - pre[s]) | dp[i-1][s]);
}
}
}
cout << dp[b][n];
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
356 KB |
Output is correct |
2 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
384 KB |
Output is correct |
2 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |