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;
#include "ricehub.h"
typedef long long ll;
priority_queue<int,vector<int>, greater<int> > pq;
int besthub(int R, int L, int X[],ll B){
ll n = R, ans = -1, act, sum;
for(ll i = 1; i < L; i++){
for(ll j = 0; j < n; j++){
pq.push(abs(i - X[j]));
}
sum = act = 0;
while(!pq.empty()){
if(sum + pq.top() > B){
pq.pop();
continue;
}else{
sum += pq.top();
act++;
}
pq.pop();
}
ans = max(ans,act);
}
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... |