#include "ricehub.h"
#define LL long long
long long f(int x, int y, int *r){
if((y-x+1)%2) return r[y+1]-r[(x+y)/2];
return r[y+1]-r[(x+y)/2+1];
}
int besthub(int n, int max_L, int in[], long long B){
int x=0, y=0, out=0;
long long sum=0;
while(x<n){
while(y+1<n && sum+f(x,y,in)<=B) sum+=f(x,y,in), y++;
out=out>y-x+1?out:y-x+1, x++;
} return out;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
5020 KB |
Output is correct |
2 |
Incorrect |
0 ms |
5020 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
5020 KB |
Output is correct |
2 |
Correct |
0 ms |
5020 KB |
Output is correct |
3 |
Correct |
0 ms |
5020 KB |
Output is correct |
4 |
Correct |
0 ms |
5020 KB |
Output is correct |
5 |
Correct |
0 ms |
5020 KB |
Output is correct |
6 |
Correct |
0 ms |
5020 KB |
Output is correct |
7 |
Correct |
0 ms |
5020 KB |
Output is correct |
8 |
Correct |
0 ms |
5020 KB |
Output is correct |
9 |
Correct |
0 ms |
5020 KB |
Output is correct |
10 |
Correct |
0 ms |
5020 KB |
Output is correct |
11 |
Correct |
0 ms |
5020 KB |
Output is correct |
12 |
Correct |
0 ms |
5020 KB |
Output is correct |
13 |
Correct |
0 ms |
5020 KB |
Output is correct |
14 |
Incorrect |
0 ms |
5020 KB |
Output isn't correct |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
5020 KB |
Output is correct |
2 |
Correct |
0 ms |
5020 KB |
Output is correct |
3 |
Correct |
0 ms |
5020 KB |
Output is correct |
4 |
Correct |
0 ms |
5020 KB |
Output is correct |
5 |
Correct |
0 ms |
5020 KB |
Output is correct |
6 |
Correct |
0 ms |
5020 KB |
Output is correct |
7 |
Correct |
0 ms |
5020 KB |
Output is correct |
8 |
Correct |
0 ms |
5020 KB |
Output is correct |
9 |
Correct |
0 ms |
5020 KB |
Output is correct |
10 |
Correct |
0 ms |
5020 KB |
Output is correct |
11 |
Correct |
0 ms |
5020 KB |
Output is correct |
12 |
Correct |
0 ms |
5020 KB |
Output is correct |
13 |
Correct |
0 ms |
5020 KB |
Output is correct |
14 |
Correct |
0 ms |
5020 KB |
Output is correct |
15 |
Incorrect |
0 ms |
5020 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
5020 KB |
Output is correct |
2 |
Correct |
3 ms |
5020 KB |
Output is correct |
3 |
Correct |
19 ms |
5020 KB |
Output is correct |
4 |
Correct |
26 ms |
5020 KB |
Output is correct |
5 |
Correct |
6 ms |
5020 KB |
Output is correct |
6 |
Correct |
6 ms |
5020 KB |
Output is correct |
7 |
Correct |
16 ms |
5020 KB |
Output is correct |
8 |
Correct |
9 ms |
5020 KB |
Output is correct |
9 |
Correct |
3 ms |
5020 KB |
Output is correct |
10 |
Correct |
13 ms |
5020 KB |
Output is correct |
11 |
Correct |
26 ms |
5020 KB |
Output is correct |
12 |
Correct |
23 ms |
5020 KB |
Output is correct |
13 |
Incorrect |
13 ms |
5020 KB |
Output isn't correct |
14 |
Halted |
0 ms |
0 KB |
- |