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 <algorithm>
#include <vector>
using namespace std;
vector < long long > all;
vector < long long > a,b;
int besthub(int R, int L, int X[], long long B)
{
long long now=0,i,j,ans=0;
for(i=R/2-10;i<=R/2+10;i++)
{
if(i<0||i>=R) continue;
all.clear();
for(j=0;j<R;j++) all.push_back((long long) abs(X[j]-X[i]));
sort(all.begin(),all.end());
now=0;
for(j=0;j<R;j++)
{
if(now+all[j]>B) break;
now+=all[j];
}
ans=max(ans,j);
}
return (int) 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... |