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 pb push_back
#define F first
#define S second
#define INF 1e18
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pii pair<int,int>
#define pll pair<ll,ll>
#define OK cout<<"Ok"<<endl;
#define MOD (ll)(1e9+7)
#define endl "\n"
int besthub(int n, int l, int arr[], long long k)
{
ll ans=0;
for(int i=0;i<l;i++){
vector<int>vt;
for(int j=0;j<n;j++){
vt.pb(abs(arr[j]-i));
}
sort(all(vt));
ll x=k,q=0;
for(int j=0;j<n;j++){
if(x>=vt[j]){
x-=vt[j];
q=j+1;
}
else{
break;
}
}
ans=max(ans,q);
}
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... |