# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
655202 | Trumling | Rice Hub (IOI11_ricehub) | C++17 | 1088 ms | 1236 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 "ricehub.h"
#include<iostream>
#include<cmath>
using namespace std;
typedef long long ll;
#define pb push_back
#define F first
#define S second
#define enter cout<<'\n';
int besthub(int R, int L, int X[], long long B)
{
bool arr[L+1]={ };
for(int i=0;i<R;i++)
{
arr[X[i]]=true;
}
ll ans=1;
ll count=0;
ll plus=R;
while(plus!=1)
{
if(ans!=1)
break;
for(int i=0;i<=R-plus;i++)
{
ll med=(i+i+plus)/2;
ll curr=0;
for(int j=i;j<i+plus;j++)
curr+=abs(X[med]-X[j]);
if(curr<=B)
{
ans=plus;
break;
}
}
plus--;
}
//cout<<'\n'<<ans<<'\n';
return ans;
}
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... |