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>
#define ll long long
using namespace std;
int besthub(int r, int l, int x[], long long b)
{
int ans = 0;
for(int i=0;i<r;i++)
{
vector<int> cost;
for(int j=0;j<r;j++)
cost.push_back(abs(x[i] - x[j]));
sort(cost.begin(), cost.end());
ll sum = 0;
int cur = 0;
while(sum < b)
{
if(cur >= r)
break;
sum += cost[cur];
cur++;
}
if(sum > b)
cur--;
ans = max(ans, cur);
}
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... |