#include <bits/stdc++.h>
using namespace std;
#define int long long
int DP[2001][2001];
int arr[2001];
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n,a,b;
cin >> n >> a >> b;
for(int i=1;i<=n;i++)cin>>arr[i];
for(auto&i:DP)fill(i,i+2001,1e15);
DP[0][0]=0;
for(int j=1;j<=b;j++){
for(int i=n;i>=j;i--){
int sum = arr[i];
for(int x=i-1;x>=j-1;x--){
DP[j][i] = min(DP[j][i],DP[j-1][x]|sum);
sum+=arr[x];
}
}
}
cout << DP[b][n] << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
31580 KB |
Output is correct |
2 |
Incorrect |
6 ms |
31696 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
31692 KB |
Output is correct |
2 |
Incorrect |
6 ms |
31580 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
31580 KB |
Output is correct |
2 |
Incorrect |
5 ms |
31580 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
31580 KB |
Output is correct |
2 |
Incorrect |
5 ms |
31620 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
31580 KB |
Output is correct |
2 |
Incorrect |
5 ms |
31652 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |