Submission #68747

#TimeUsernameProblemLanguageResultExecution timeMemory
68747FedericoSBali Sculptures (APIO15_sculpture)C++14
0 / 100
5 ms1176 KiB
#include <iostream> using namespace std; typedef long long int ll; ll INF=1e9; ll P=10; int N,A,B; ll Y[2005]; ll V[2005]; ll ans,res; int main(){ cin>>N>>A>>B; for(int i=0;i<N;i++) cin>>Y[i]; ans=(1LL<<P)-1; for(int c=P-1;c>=0;c--){ ans=ans^(1LL<<c); fill(V,V+N,INF); for(int i=N-1;i>=0;i--){ res=0; for(int j=i;j<N;j++){ res+=Y[j]; if((res|ans)==ans) V[i]=min(V[i],V[j+1]+1); } } if(V[0]==INF or V[0]>B) ans=ans^(1LL<<c); //for(int i=0;i<N+1;i++)cout<<(V[i]==INF?-1:V[i])<<" ";cout<<endl; } cout<<ans; } /* 6 1 3 8 1 2 1 5 4 */
#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...