#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>
/*
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.begin(), x.end(), max(0LL,x[i]-b))- x.begin());
r = upper_bound(x.begin(), x.end(), min((ll) last, x[i]+b)) - x.begin() - (i+1);
// cout << x[i] << " " <<l << " " << r << endl;
ans = max(l+r+1,ans);
}
return ans;
}
*/
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;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
432 KB |
Output is correct |
4 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |