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 ll long long
using namespace std;
//int r,l;
//ll d;
//int x[100005];
int besthub(int R, int L, int X[], long long B)
{
int ans=0;
for(int i=1;i<R-1;i++)
{
int cnt=0;
ll b=B;
priority_queue<ll,vector<ll>,greater<ll>> pq;
for(int j=0;j<R;j++)
pq.push(abs(X[j]-X[i]));
while(!pq.empty())
{
if(b-pq.top()<0)
break;
b-=pq.top();
pq.pop();
cnt++;
}
ans=max(ans,cnt);
}
return ans;
}
//int main()
//{
// cin >> r >> l >> d;
// for(int i=0;i<r;i++)
// cin >> x[i];
// cout << besthub(r,l,x,d);
// return 0;
//}
/**
5 20 6
1 2 10 12 14
**/
| # | 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... |