This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*
bf sol
*/
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
#define ins insert
#define pb push_back
// #define int long long int
#define pii pair<int, int>
#define endl '\n'
#define drop(x) cout<<(x)<<endl; return;
#define all(x) x.begin(),x.end()
int besthub(int n, int mxL, int arr[], long long B){
int ans=0;
/*
her i ucun ele j tapaqki :
j<i
j ni goturmesek i+1 right terefden nese ekstra goture bilirik
*/
for(int i=0;i<n;i++){
multiset<int> lst;
int cnt=0;
for(int j=0;j<n;j++){
lst.ins(abs(arr[i]-arr[j]));
}
int sum=0;
for(auto v:lst){
if(sum+v>B){
break;
}
sum+=v;
cnt++;
}
ans=max(ans,cnt);
}
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... |