#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,A,B;
cin>>n>>A>>B;
int a[n], dp[n][B], su=0;
for (int i=0;i<n;i++)
for (int j=0;j<B;j++)
dp[i][j]=2e9;
for (int i=0;i<n;i++)
cin>>a[i],su+=a[i],dp[i][0]=su;
for (int len=1;len<B;len++)
for (int i=len;i<n;i++)
{
su=0;
for (int j=i;j>len-1;j--)
su+=a[j],dp[i][len]=min(dp[i][len],su|dp[j-1][len-1]);
}
int ans=2e9;
for (int i=A-1;i<B;i++)
ans=min(ans,dp[n-1][i]);
cout<<ans<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
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 |
- |
# |
Verdict |
Execution time |
Memory |
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 |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
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 |
- |