This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector <ll> arr;
ll RO(ll budget, ll cord) {
priority_queue <ll, vector <ll>, greater <ll> > pq;
for (ll x : arr) pq.push(abs(x-cord));
ll paks = 0, suma = 0;
while (!pq.empty() && suma <= budget) {
ll curr = pq.top();
pq.pop();
if (suma + curr <= budget) suma += curr, paks++;
else break;
}
return paks;
}
int besthub(int R, int L, int X[], ll B) {
for (ll i=0; i<R; i++) arr.push_back((ll)X[i]);
ll maxi = 0;
for (ll i : arr) {
maxi = max(maxi, RO(B, i));
}
return maxi;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |