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;
int besthub(int R, int L, int X[], long long B)
{
int ans=0;
for (int i=1; i<=L; i++) {
vector<ll> c;
for (int j=0; j<R; j++) {
c.push_back(abs(i-X[j]));
}
sort(c.begin(),c.end());
ll used=0;
int a=0;
for (ll i: c) {
if (used+i<=B) {
used+=i;
a++;
} else break;
}
ans=max(ans,a);
}
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... |