Submission #500129

#TimeUsernameProblemLanguageResultExecution timeMemory
500129beaconmcRice Hub (IOI11_ricehub)C++14
0 / 100
27 ms2128 KiB
#include "ricehub.h" #include <bits/stdc++.h> typedef long long ll; #define FOR(i, x, y) for(ll i=x; i<y; i++) using namespace std; int besthub(int R, int L, int X[], ll B){ sort(X, X+R); ll med; if (R%2==0) med = (X[R/2] + X[R/2-1])/2; else med = X[R/2]; ll ans = 0; int costs[100000]; FOR(i,0,R){ costs[i] = abs(X[i] - med); } sort(costs, costs+R); FOR(i,0,R){ if (B - costs[i] >=0) ans++, B-= costs[i]; else break; } 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...