# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
388061 | Pichon5 | Rice Hub (IOI11_ricehub) | C++17 | 338 ms | 472 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 <bits/stdc++.h>
#define vi vector<int>
#define pb push_back
#define ll long long int
using namespace std;
int besthub(int R, int L, int X[], long long B)
{
vi v;
int res=0;
for(int i=0;i<R;i++){
int b=i,e=R-1;
while(b<=e){
int mid=(b+e)/2;
v.clear();
for(int l=i;l<=mid;l++){
v.pb(X[l]);
}
int MID=v.size()/2;
ll aux=0;
for(int l=0;l<v.size();l++){
aux+=abs(v[l]-v[MID]);
}
if(aux<=B){
res=max(res,e-b+1);
b=mid+1;
}else{
e=mid-1;
}
}
}
return res;
}
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... |