Submission #495672

#TimeUsernameProblemLanguageResultExecution timeMemory
495672AndresTLRice Hub (IOI11_ricehub)C++11
100 / 100
18 ms1812 KiB
#include "ricehub.h" #include <algorithm> typedef long long ll; using namespace std; int besthub(int R, int L, int X[], long long B){ int l=0,r=0, m, nueva_m=0, MaxR=1; ll b_gastado = 0; while(r<R-1){ if (b_gastado<=B){ r++; m=(l+r)/2; b_gastado+=abs(X[r]-X[m]); if (b_gastado<=B) MaxR=max(MaxR,r-l+1); }else{ l++; nueva_m=(l+r)/2; b_gastado-=abs(X[nueva_m]-X[l-1]); if (b_gastado<=B) MaxR=max(MaxR,r-l+1); } } return MaxR; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...