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 "bits/stdc++.h"
using namespace std;
#define ll long long
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
int besthub(int r, int l, int x[], ll b){
int answer = 1;
deque<int> diff;
for(int cor = 1; cor <= l; ++cor){
diff.clear();
int sm = 0;
for(int i = 0; i < r; ++i)
diff.push_back(abs(cor-x[i]));
sort(all(diff));
while(1){
if(b-diff[0] >= 0)
b -= diff[0], diff.pop_front(), sm++;
else
break;
}
answer = max(answer, sm);
}
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... |