Submission #614807

#TimeUsernameProblemLanguageResultExecution timeMemory
614807ShithilaRice Hub (IOI11_ricehub)C++14
0 / 100
1066 ms504 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; int 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); int sum=0; int j=0; while(sum<=B && i<R) { sum=sum+dis[j]; j++; } sum=sum-dis[j]; if(max<sum) { max=sum; pos=i; } } return max; }

Compilation message (stderr)

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:7:6: warning: variable 'pos' set but not used [-Wunused-but-set-variable]
    7 |  int pos=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...