# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1003095 | 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.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define f first
#define s second
#define pf push_front
#define pb push_back
#define pi pair<int,int>
#define vi vector<int>
ll besthub(int n, int last, vi x, int b){
int prev, op;
ll l,r;
ll ans = 0;
for(int i = 0; i < n; i++){
l = i - (lower_bound(x.begin(), x.end(), max(0,x[i]-b))- x.begin());
r = upper_bound(x.begin(), x.end(), min(last, x[i]+b)) - x.begin() - (i+1);
// cout << x[i] << " " <<l << " " << r << endl;
ans = max(l+r+1,ans);
}
return ans;
}