Submission #1028675

#TimeUsernameProblemLanguageResultExecution timeMemory
1028675vjudge1Bali Sculptures (APIO15_sculpture)C++17
0 / 100
1 ms600 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n,A,B; cin>>n>>A>>B; int ans=0; int a[n],pre[n+1]={}; for (int i=0;i<n;i++) cin>>a[i],pre[i+1]=pre[i]+a[i]; for (int p=30;p>=0;p--) { int lim=ans+(1<<p),i=0,seg=0; bool b=1; while (i<n && b) { int x=lower_bound(pre,pre+n+1,pre[i]+lim)-pre; int y=lower_bound(pre,pre+n+1,pre[i]+ans)-pre; if (x==y or x==i+1) b=0; seg++; i=x-1; } if (!(b && seg<=B)) ans+=(1<<p); } cout<<ans<<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...