#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
long long s[100001];
int mx;
int besthub(int R, int L, int X[], long long B){
for (int i=0;i<R;i++)
s[i]=(i?s[i-1]:0)+X[i];
for (int i=0;i<R;i++){
int l=i,r=R-1,kq=-1;
while (l<=r){
int mid=(l+r)>>1;
int median=(i+mid)>>1;
if (1LL*X[median]*(median*2-i-mid+1)-s[median]*2+(i?s[i-1]:0)+s[mid]<=B){
kq=mid;
l=mid+1;
}
else
r=mid-1;
}
mx=max(mx,kq-i+1);
}
return mx;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2492 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2552 KB |
Output is correct |
6 |
Correct |
1 ms |
2396 KB |
Output is correct |
7 |
Correct |
1 ms |
2396 KB |
Output is correct |
8 |
Correct |
1 ms |
2396 KB |
Output is correct |
9 |
Correct |
1 ms |
2396 KB |
Output is correct |
10 |
Correct |
0 ms |
2396 KB |
Output is correct |
11 |
Correct |
1 ms |
2396 KB |
Output is correct |
12 |
Correct |
1 ms |
2396 KB |
Output is correct |
13 |
Correct |
1 ms |
2396 KB |
Output is correct |
14 |
Correct |
1 ms |
2492 KB |
Output is correct |
15 |
Correct |
1 ms |
2396 KB |
Output is correct |
16 |
Correct |
1 ms |
2396 KB |
Output is correct |
17 |
Correct |
1 ms |
2396 KB |
Output is correct |
18 |
Correct |
1 ms |
2396 KB |
Output is correct |
19 |
Correct |
1 ms |
2396 KB |
Output is correct |
20 |
Correct |
1 ms |
2396 KB |
Output is correct |
21 |
Correct |
1 ms |
2396 KB |
Output is correct |
22 |
Correct |
1 ms |
2396 KB |
Output is correct |
23 |
Correct |
1 ms |
2396 KB |
Output is correct |
24 |
Correct |
1 ms |
2396 KB |
Output is correct |
25 |
Correct |
1 ms |
2496 KB |
Output is correct |
26 |
Correct |
1 ms |
2396 KB |
Output is correct |
27 |
Correct |
1 ms |
2396 KB |
Output is correct |
28 |
Correct |
1 ms |
2396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2492 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
1 ms |
2396 KB |
Output is correct |
7 |
Correct |
1 ms |
2396 KB |
Output is correct |
8 |
Correct |
1 ms |
2652 KB |
Output is correct |
9 |
Correct |
1 ms |
2396 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
11 |
Correct |
1 ms |
2396 KB |
Output is correct |
12 |
Correct |
1 ms |
2396 KB |
Output is correct |
13 |
Correct |
1 ms |
2396 KB |
Output is correct |
14 |
Correct |
1 ms |
2396 KB |
Output is correct |
15 |
Correct |
1 ms |
2396 KB |
Output is correct |
16 |
Correct |
1 ms |
2488 KB |
Output is correct |
17 |
Correct |
1 ms |
2396 KB |
Output is correct |
18 |
Correct |
1 ms |
2424 KB |
Output is correct |
19 |
Correct |
1 ms |
2392 KB |
Output is correct |
20 |
Correct |
1 ms |
2496 KB |
Output is correct |
21 |
Correct |
1 ms |
2392 KB |
Output is correct |
22 |
Correct |
1 ms |
2552 KB |
Output is correct |
23 |
Correct |
1 ms |
2396 KB |
Output is correct |
24 |
Correct |
1 ms |
2396 KB |
Output is correct |
25 |
Correct |
1 ms |
2396 KB |
Output is correct |
26 |
Correct |
1 ms |
2396 KB |
Output is correct |
27 |
Correct |
2 ms |
2396 KB |
Output is correct |
28 |
Correct |
1 ms |
2396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
2652 KB |
Output is correct |
2 |
Correct |
3 ms |
2624 KB |
Output is correct |
3 |
Correct |
14 ms |
3676 KB |
Output is correct |
4 |
Correct |
13 ms |
3676 KB |
Output is correct |
5 |
Correct |
6 ms |
2908 KB |
Output is correct |
6 |
Correct |
6 ms |
2908 KB |
Output is correct |
7 |
Correct |
11 ms |
3420 KB |
Output is correct |
8 |
Correct |
12 ms |
3420 KB |
Output is correct |
9 |
Correct |
6 ms |
2908 KB |
Output is correct |
10 |
Correct |
7 ms |
2904 KB |
Output is correct |
11 |
Correct |
13 ms |
3624 KB |
Output is correct |
12 |
Correct |
13 ms |
3624 KB |
Output is correct |
13 |
Correct |
6 ms |
3056 KB |
Output is correct |
14 |
Correct |
6 ms |
3056 KB |
Output is correct |
15 |
Correct |
9 ms |
3416 KB |
Output is correct |
16 |
Correct |
9 ms |
3368 KB |
Output is correct |
17 |
Correct |
12 ms |
3572 KB |
Output is correct |
18 |
Correct |
14 ms |
3420 KB |
Output is correct |
19 |
Correct |
12 ms |
3672 KB |
Output is correct |
20 |
Correct |
12 ms |
3500 KB |
Output is correct |