# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
655211 | AntonisPapaev | Rice Hub (IOI11_ricehub) | C++17 | 1084 ms | 852 KiB |
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<iostream>
#include<cmath>
#include<algorithm>
#include<utility>
#include<vector>
#include "ricehub.h"
int besthub(int R, int L, int X[], long long B)
{
std::pair<long long,long long> ans{0,-1};
std::vector<long long> p;
for(int i=0;i<L;i++) {
p.clear();
long long cnt=0,check=0;
for (int j=0;j<R;j++)
p.push_back(abs(i-X[j]));
std::sort(p.begin(),p.end());
for (int k=0;k<p.size();k++)
if (check+p[k]<=B) {
check+=p[k];
cnt++; }
else
break;
if (cnt>=ans.first)
ans={cnt,i};
}
return ans.first;
}
Compilation message (stderr)
# | 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... |