Submission #880454

#TimeUsernameProblemLanguageResultExecution timeMemory
880454androRice Hub (IOI11_ricehub)C++14
17 / 100
1065 ms500 KiB
#include <bits/stdc++.h> #include "ricehub.h" //#define int long long using namespace std; int besthub(int R, int L, int X[], long long B){ int ans=0; for(int i=1;i<=R;i++){ //od desno kolko ih ima u [X[i],X[i]+mid] // od levo [X[i]-mid,X[i]] int l=0,r=11000,p=-1; while(l<=r){ int mid=(l+r)/2; int c=0; for(int j=1;j<=R;j++){ if(abs(X[i]-X[j])<=mid)c+=abs(X[i]-X[j]); } if(c<=B){ l=mid+1; p=mid; } else { r=mid-1; } } int u=0; for(int j=1;j<=R;j++){ if(abs(X[i]-X[j])<=p)u++; } ans=max(ans,u); } return ans; }/* signed main(){ int X[4]={0,10,12,14}; cout<<besthub(3,14,X,6); }*/ /* 1 3 2 3 3 3 3 */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...