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
const ll sz=50005;
ll a[sz], b[sz], d[sz], s[sz];
int besthub(int r, int l, int x[], long long k)
{
ll ans=0;
for(int i=0; i<r; i++){
vector<ll>v;
for(int j=0; j<r; j++){
v.push_back(abs(x[i]-x[j]));
sort(v.begin(), v.end());
}
ll sum=0;
for(int j=0; j<r; j++){
if(sum+v[j]>k) break;
sum+=v[j];
ans=max(ans, (ll)j+1);
}
}
return ans;
}
/*
{} []
5 20 6
1 2 10 12 14 3
*/
# | 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... |