#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];
int ans = 2e9;
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]);
}
if(i >= a || i <=b) ans = min(ans,dp[i][n]);
}
}
cout << ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |