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;
int besthub(int R, int L, int X[], long long B) {
int mx = 0;
for (int i = 0; i < R; i++) {
vector<int> dist;
for (int j = 0; j < R; j++) {
dist.emplace_back( abs (X[i] - X[j] ) );
}
sort (dist.begin(), dist.end());
long long cur = B;
int got = 0;
for (int i = 0; i < R; i++) {
if (cur - dist[i] >= 0) {
cur -= dist[i];
++got;
} else break;
}
mx = max (mx, got);
}
return mx;
}
# | 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... |