| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 1003100 | vjudge1 | Rice Hub (IOI11_ricehub) | C++17 | 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.
int besthub(int n, int last, int x[], ll b){
    
    int ans = 0;
    int l , r;
    for(int i = 0; i < n; i++){
        
        l = i - (lower_bound(x, x + n, max(0LL,x[i]-b))- x);
        r =  (upper_bound(x, x +n, min((ll) last, x[i]+b)) -x) - (i+1);
       // cout << x[i] << " " <<l << " " << r << endl;
        ans = max(l+r+1,ans);
    }
    
    return ans;
}
