| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 500829 | beaconmc | Rice Hub (IOI11_ricehub) | C++14 | 0 ms | 0 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.
typedef long long ll;
using namespace std;
int besthub(int R,int L,int X[],ll B){
ll lo=0,hi=0,ans=1,curcost=0;
while (hi<R){
if ((hi-lo)%2==0 && hi!=lo) curcost += X[hi] - X[(hi-lo-1)/2+1 + lo];
else curcost += X[hi] - X[(hi-lo-1)/2 + lo];
if (curcost>B){
if ((hi-lo)%2==0) curcost += X[lo] -X[hi];
else curcost += X[lo] - X[hi];
lo ++;
} else hi++;
ans = max(ans, hi-lo);
}
return ans;
}
