# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
224669 | 2020-04-18T14:44:05 Z | Amy313 | Rice Hub (IOI11_ricehub) | C++14 | 0 ms | 0 KB |
#include "ricehub.h" #include<bits/stdc++.h> using namespace std; int besthub(int R, int L, int X[], long long B) {vector<int>V; int maxi= 0, c, a; long long cp = B; for(int i=1; i<=L; i++) { c = 0; cp = B; for(int j=0; j<R; j++) { a = abs(i-X[j]); V.push_back(a); } sort(V.begin(), V.end()); for(int i=0; i<V.size(); i++) { if(V[j]<=cp) { cp-=V[j]; c++; } else { break; } } if(c>maxi) { maxi = c; } } return maxi; }