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>
#define int long long
#define iris 998244353
using namespace std;
set<int> dp[2010][2010];
int arr[2010];
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n,ans,i,j,k,a,b;
cin>>n>>a>>b;
for(i=1;i<=n;i++)
{
cin>>arr[i];
arr[i]+=arr[i-1];
}
dp[0][0].insert(0);
for(i=1;i<=b;i++)
{
for(j=1;j<=n;j++)
{
for(k=0;k<j;k++)
{
for(int ouo:dp[i-1][k])
{
dp[i][j].insert(ouo|(arr[j]-arr[k]));
}
}
}
}
ans=1e18;
for(i=a;i<=b;i++)
{
ans=min(ans, *dp[i][n].lower_bound(-1));
}
cout<<ans<<'\n';
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... |