Submission #602873

#TimeUsernameProblemLanguageResultExecution timeMemory
602873FidanBali Sculptures (APIO15_sculpture)C++17
9 / 100
555 ms304 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll inf=(1e18)+10; int main(){ ll n, a, b, i, j; cin>>n>>a>>b; vector<ll> v(n, 0); for(i=0; i<n; i++){ cin>>v[i]; } if(n==1){ cout<<v[0]; return 0; } a--, b--; ll mn=inf; for(i=0; i<(1<<(n-1)); i++){ ll s1=0; for(j=0; j<n-1; j++){ if((i & (1<<j)) > 0){ s1++; } } if(s1<a || s1>b) continue; ll s=0, k=0; for(j=0; j<n-1; j++){ s+=v[n-1-j]; if((i & (1<<j)) > 0){ k=(k|s); s=0; } } s+=v[0]; k=(k|s); mn=min(k, mn); } cout<<mn; 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...