Submission #495673

#TimeUsernameProblemLanguageResultExecution timeMemory
495673AndresTLRice Hub (IOI11_ricehub)C++11
100 / 100
18 ms636 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, 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++; m=(l+r)/2; b_gastado-=abs(X[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...