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
int besthub(int n, int m, int a[], ll k)
{
ll ans = 0;
for(int i = 0; i < n; i++){
vector<int> v; v.clear();
for(int j = 0; j < n; j++)
v.push_back(abs(a[i]-a[j]));
sort(v.begin(), v.end());
for(int i = 1; i < n; i++) v[i]+=v[i-1];
int pos = upper_bound(v.begin(), v.end(), k)-v.begin();
if(ans<pos)ans=pos;
}
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... |