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;
#define endl '\n'
#define ll long long
#define pll pair<ll, ll>
int besthub(int n, int l, int a[], long long b)
{
ll mx = 0;
for (ll i = 0; i<n; i++){
priority_queue<ll, vector<ll>, greater<ll>>pq;
for (ll j = 0; j<n; j++){
pq.push(abs(a[j] - a[i]));
}
ll sum = 0, cnt = 0;
while (pq.size()){
ll x = pq.top();
pq.pop();
sum += x;
cnt++;
if (sum > b){
sum -= x;
cnt--;
break;
}
}
mx = max(mx, cnt);
}
return mx;
}
# | 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... |