Submission #551198

#TimeUsernameProblemLanguageResultExecution timeMemory
551198alirezasamimi100Rice Hub (IOI11_ricehub)C++17
100 / 100
21 ms1748 KiB
#include "ricehub.h" #include <bits/stdc++.h> using namespace std; using ll = long long int; #define pb push_back int besthub(int R, int L, int X[], ll B){ ll p=0,ans=0,c=0,m=0; for(ll i=0; i<R; i++){ if(m-i<p-m){ c+=(X[m+1]-X[m])*(p-m-(m-i+1)); m++; } while(c<=B && p<R){ p++; if(p!=R){ c+=X[p]-X[m]; if(m-i<p-m){ c+=(X[m+1]-X[m])*(p-m-(m-i+1)); m++; } }else{ ans=max(ans,p-i); return ans; } } ans=max(ans,p-i); c-=X[m]-X[i]; } 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...