Submission #961789

#TimeUsernameProblemLanguageResultExecution timeMemory
961789hirayuu_ojRice Hub (IOI11_ricehub)C++17
0 / 100
2 ms860 KiB
#include "ricehub.h" #include<bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0; i<(n); i++) #define all(x) x.begin(),x.end() using ll=long long; const ll INF=1LL<<60; int besthub(int R, int L, int X[], long long B){ vector<ll> cum(R+1,0); vector<ll> x(R); rep(i,R){ x[i]=X[i]; cum[i+1]=cum[i]+x[i]; } ll ok=1,ng=R+1; while(ng-ok>1){ ll mid=(ok+ng)>>1; ll half=mid>>1; bool can=0; rep(i,R-mid+1){ ll lf=cum[i+half]-cum[i]; ll ri=cum[i+mid]-cum[i+half]; ll rs=0; if(mid&1)rs-=R; if(rs+ri-lf<=B){ can=1; } } if(can)ok=mid; else ng=mid; } return ok; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...