#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 1e5 + 9 , mod = 1e9 + 7;
ll a[N] ;
int besthub(int R, int L, int *X, ll B) {
ll i , l , r , m , x , s , ans = 0;
for(i = 1; i <= R; i++)
a[i] = X[i - 1] + a[i - 1];
for(i = 1; i <= R; i++){
l = i , r = R;
while(l != r){
m = (l + r + 1) / 2;
x = (m + i) / 2;
s = (a[x] * (x - i) - (a[x - 1] - a[i - 1])) + (a[m] - a[x] - a[x] * (m - x));
if(s <= B) l = m;
else r = m - 1;
}
ans = max(ans , r - i + 1);
}
return ans;
}
// Author : حسن
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
2652 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |