Submission #126387

#TimeUsernameProblemLanguageResultExecution timeMemory
126387The_WolfpackBali Sculptures (APIO15_sculpture)C++14
50 / 100
88 ms504 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...