#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int R,L;
int X[100001];
ll Sum_X[100001];
ll B;
int Ans;
ll f(int l,int r){
int m=(l+r)>>1;
return X[m]*(m-l)-(Sum_X[m-1]-Sum_X[l-1])+(Sum_X[r]-Sum_X[m])-X[m]*(r-m);
}
int besthub(int r,int l,int x[],ll b){
R=r;
L=l;
for (int i=1; i<=R; i++){
X[i]=x[i-1];
Sum_X[i]=Sum_X[i-1]+X[i];
}
B=b;
for (int i=1,j=1; i<=R; i++){
while (j<R){
if (f(i,j+1)>B)
break;
j++;
}
Ans=max(Ans,j-i+1);
}
return Ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
304 KB |
Output is correct |
3 |
Correct |
0 ms |
308 KB |
Output is correct |
4 |
Correct |
1 ms |
304 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
300 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |
11 |
Correct |
0 ms |
204 KB |
Output is correct |
12 |
Correct |
0 ms |
204 KB |
Output is correct |
13 |
Correct |
0 ms |
204 KB |
Output is correct |
14 |
Correct |
1 ms |
204 KB |
Output is correct |
15 |
Correct |
0 ms |
308 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
0 ms |
304 KB |
Output is correct |
19 |
Correct |
0 ms |
204 KB |
Output is correct |
20 |
Correct |
0 ms |
204 KB |
Output is correct |
21 |
Correct |
1 ms |
204 KB |
Output is correct |
22 |
Correct |
1 ms |
304 KB |
Output is correct |
23 |
Correct |
1 ms |
204 KB |
Output is correct |
24 |
Correct |
1 ms |
204 KB |
Output is correct |
25 |
Correct |
0 ms |
204 KB |
Output is correct |
26 |
Correct |
1 ms |
304 KB |
Output is correct |
27 |
Correct |
1 ms |
204 KB |
Output is correct |
28 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
308 KB |
Output is correct |
4 |
Correct |
1 ms |
308 KB |
Output is correct |
5 |
Correct |
1 ms |
332 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
8 |
Correct |
0 ms |
312 KB |
Output is correct |
9 |
Correct |
1 ms |
332 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
332 KB |
Output is correct |
12 |
Correct |
1 ms |
332 KB |
Output is correct |
13 |
Correct |
1 ms |
332 KB |
Output is correct |
14 |
Correct |
1 ms |
332 KB |
Output is correct |
15 |
Correct |
1 ms |
204 KB |
Output is correct |
16 |
Correct |
1 ms |
300 KB |
Output is correct |
17 |
Correct |
1 ms |
332 KB |
Output is correct |
18 |
Correct |
0 ms |
312 KB |
Output is correct |
19 |
Correct |
0 ms |
332 KB |
Output is correct |
20 |
Correct |
0 ms |
320 KB |
Output is correct |
21 |
Correct |
1 ms |
316 KB |
Output is correct |
22 |
Correct |
1 ms |
340 KB |
Output is correct |
23 |
Correct |
1 ms |
332 KB |
Output is correct |
24 |
Correct |
1 ms |
332 KB |
Output is correct |
25 |
Correct |
1 ms |
308 KB |
Output is correct |
26 |
Correct |
1 ms |
332 KB |
Output is correct |
27 |
Correct |
1 ms |
340 KB |
Output is correct |
28 |
Correct |
1 ms |
332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
700 KB |
Output is correct |
2 |
Correct |
3 ms |
716 KB |
Output is correct |
3 |
Correct |
12 ms |
2880 KB |
Output is correct |
4 |
Correct |
12 ms |
2816 KB |
Output is correct |
5 |
Correct |
5 ms |
1412 KB |
Output is correct |
6 |
Correct |
5 ms |
1340 KB |
Output is correct |
7 |
Correct |
10 ms |
2500 KB |
Output is correct |
8 |
Correct |
10 ms |
2592 KB |
Output is correct |
9 |
Correct |
6 ms |
1300 KB |
Output is correct |
10 |
Correct |
5 ms |
1248 KB |
Output is correct |
11 |
Correct |
15 ms |
2856 KB |
Output is correct |
12 |
Correct |
12 ms |
2852 KB |
Output is correct |
13 |
Correct |
5 ms |
1460 KB |
Output is correct |
14 |
Correct |
5 ms |
1484 KB |
Output is correct |
15 |
Correct |
8 ms |
2132 KB |
Output is correct |
16 |
Correct |
8 ms |
2144 KB |
Output is correct |
17 |
Correct |
11 ms |
2540 KB |
Output is correct |
18 |
Incorrect |
12 ms |
2632 KB |
Output isn't correct |
19 |
Halted |
0 ms |
0 KB |
- |