This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |