Submission #1056724

#TimeUsernameProblemLanguageResultExecution timeMemory
1056724PikachudoraEHERice Hub (IOI11_ricehub)C++14
0 / 100
3 ms2396 KiB
#include "ricehub.h" #include<bits/stdc++.h> using namespace std; long long idx[100005];int n;long long qs[100005]; bool chk(int a){ long long mi=LLONG_MAX; for(int l=1;l<=n-a+1;l++){ int r =l+a-1;int m=(l+r)/2; mi=min(mi,(m-l+1)*idx[m]-qs[m]-(r-m)*(idx[m])+qs[r]-qs[m]); } return mi<=a; } int besthub(int R, int L, int X[], long long B){ int l=0;int r=R;n=R; for(int i=0;i<R;i++){idx[i+1]=X[i];qs[i+1]=qs[i]+idx[i+1];} while(l<r){ int mid = (l+r+1)/2; if(chk(mid)){ l=mid; } else{ r =mid-1; } } return l; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...