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 ll long long
#define pll pair<ll, ll>
#define pii pair<int, int>
#define fs first
#define sc second
#define pb push_back
int besthub(int n, int l, int X[], long long b)
{
ll a[n],ans=0;
for(int i=0;i<n;i++)a[i]=X[i];
for(int i=0;i<n;i++){
vector<ll> v;
for(int j=0;j<n;j++)v.pb(abs(a[i]-a[j]));
sort(v.begin(),v.end());
ll s=0,c=0;
for(int i=0;i<n;i++){
s+=v[i];
if(s>b)break;
c++;
}
ans=max(ans,c);
}
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... |