This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
bool verify(long long sum[], int r, int l, int x[], long long b, int nr)
{
    int st, dr, mij;
    long long total;
    for(int i=0;i<r-nr+1;i++)
    {
        st=i+1;
        dr=i+nr;
        mij=(st+dr)/2;
        total=0;
        total=total+x[mij-1]*(mij-st+1);
        total=total-(sum[mij]-sum[st-1]);
        total=total+(sum[dr]-sum[mij]);
        total=total-x[mij-1]*(dr-mij);
        if(total<=b)
            return true;
    }
    return false;
}
int besthub(int r, int l, int x[], long long b)
{
    long long sum[100005]={};
    sum[0]=0;
    for(int i=1;i<=r;i++)
        sum[i]=sum[i-1]+x[i-1];
    int st=1, dr=r+1, mij;
    while(dr-st>1)
    {
        mij=(st+dr)/2;
        if(verify(sum,r,l,x,b,mij))
            st=mij;
        else
            dr=mij;
    }
    return st;
}
| # | 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... |