Submission #922142

#TimeUsernameProblemLanguageResultExecution timeMemory
922142tamir1Rice Hub (IOI11_ricehub)C++14
100 / 100
11 ms1884 KiB
#include "ricehub.h" #include<bits/stdc++.h> #define ll long long using namespace std; ll ans,cur,i,sz,med,fi; int besthub(int R, int L, int X[], long long B) { fi=-1; sz=1; for(i=1;i<R;i++){ sz++; if(sz%2==1){ cur+=(X[i]-X[med]); } else{ cur+=(X[med+1]-X[med]); med++; cur+=(X[i]-X[med]); } while(cur>B){ sz--; fi++; if(sz%2==1){ cur-=(X[med]-X[fi]); } else{ cur+=(X[med+1]-X[med]); med++; cur-=(X[med]-X[fi]); } } ans=max(ans,sz); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...