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 ll long long
using namespace std;
const int NMAX=2007;
int n,a,b;
int dp[NMAX];
ll y[NMAX];
int main()
{
ios_base::sync_with_stdio(false);
cin>>n>>a>>b;
for(int i=0;i<n;i++) cin>>y[i];
ll res=0;
for(int i=40;i>=0;i--)
{
ll cur=res | (1ll<<i);
for(int j=0;j<=n;j++) dp[j]=n+1;
dp[0]=0;
for(int j=0;j<n;j++)
{
ll sum=0;
for(int k=j;k<n;k++)
{
sum+=y[k];
if((sum&cur)==0) dp[k+1]=min(dp[k+1],dp[j]+1);
}
}
if(dp[n]<=b) res+=(1ll<<i);
}
cout<<(1ll<<41)-1-res<<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... |