# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
407245 | 2021-05-18T16:30:35 Z | danielcm585 | Rice Hub (IOI11_ricehub) | C++14 | 0 ms | 0 KB |
#include "grader.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; int besthub(int N, int L, int X[], ll B){ sort(X,X+N); int ans = 0; vector<int> v; for (int i = 0; i < N; i++) v.push_back(abs(X[i]-X[N/2])); sort(v.begin(),v.end()); for (int i : v) { if (B < i) break; ans++; B -= i; } return ans; }