Submission #614872

#TimeUsernameProblemLanguageResultExecution timeMemory
614872ShithilaRice Hub (IOI11_ricehub)C++14
17 / 100
1086 ms340 KiB
#include "ricehub.h" #include <bits/stdc++.h> using namespace std; int besthub(int R, int L, int X[], long long B) { int dis[R]; int pos=0; long long max=0; for(int i=0;i<L;i++) { for(int j=0;j<R;j++) { dis[j]=abs(i-X[j]); } sort(dis,dis+R); long long sum=0; int j=0; while(sum<=B && j<R) { sum=sum+dis[j]; j++; } j--; if(pos<j) { pos=j; } //cout<<i<<" "<<j<<endl; } return pos; }

Compilation message (stderr)

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:8:12: warning: unused variable 'max' [-Wunused-variable]
    8 |  long long max=0;
      |            ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...