#include <bits/stdc++.h>
#include "ricehub.h"
using namespace std;
using ll = long long;
int besthub(int R, int L, int X[], long long B) {
int maxans = 1;
for (int i = 0; i < R; i++) {
vector<ll> vll;
for (int j = 0; j < R; j++)
if (j != i) vll.push_back(abs(X[i] - X[j]));
sort(vll.begin(), vll.end());
ll cur = 0;
for (int i = 0; i < vll.size(); i++)
if (cur + vll[i] > B) {
maxans = max(maxans, i + 1);
goto A;
} else
cur += vll[i];
maxans = max(maxans, R);
A:;
}
return maxans;
}
# | 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... |