# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1003095 | 2024-06-20T06:02:42 Z | vjudge1 | Rice Hub (IOI11_ricehub) | C++17 | 0 ms | 0 KB |
#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; }