#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
int besthub(int R, int L, int X[], long long B)
{
// sub1
int resp = 0;
for (int j = 0; j < R; j++) {
int hub = X[j];
vector<int> dists;
for (int i = 0; i < R; i++) {
dists.push_back(abs(X[i] - hub));
}
sort(dists.begin(), dists.end());
int cur_resp = 0;
int money = B;
for (int i = 0; i < R; i++) {
if (dists[i] > money) break;
cur_resp++;
money -= dists[i];
}
resp = max(cur_resp, resp);
}
return resp;
}
# | 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... |