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>
#include "ricehub.h"
#define sz(s) (int)s.size()
using namespace std;
#define ll long long
int besthub(int n, int L, int a[], ll b){
int ind = n/2;
vector <int> v;
for(int i = 0; i < n; i++){
v.push_back(abs(a[i]-a[ind]));
}
sort(v.rbegin(), v.rend());
int ans = 0;
while(sz(v) > 0){
if(v.back() > b) break;
b -= v.back();
v.pop_back();
ans++;
}
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... |