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 n, int l, int x[], long long B) {
int ans = 0;
for (int i = 0; i < n; i++) {
int co = 0;
long long s = B;
vector<int> a;
for (int j = 0; j < n; j++) {
a.push_back(abs(x[i]-x[j]));
}
sort(a.rbegin(), a.rend());
while(!a.empty() && a.back() <= s) {
co++;
s -= a.back();
a.pop_back();
}
ans = max(ans, co);
}
return ans;
}
# | 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... |