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"
#define ll long long
using namespace std;
int besthub(int R, int L, int X[], long long B){
int answer = 0;
for (int i = 1; i <= L; i++){
vector<int> dist;
for (int j = 0; j < R; j++)
dist.push_back(abs(X[j] - i));
sort(dist.begin(), dist.end());
ll budget = 0;
int count = 0;
for (auto x: dist){
budget += x;
if (budget > B)
break;
count += 1;
}
answer = max(answer, count);
}
return answer;
}
# | 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... |