#include "gap.h"
#include<bits/stdc++.h>
using namespace std;
long long MX=1000000000000000000;
long long findGap(int T, int N)
{
long long mn,mx,pas=1,mn1,mx1,xr=1;
MinMax(0,MX,&mn,&mx);
if(T==1){
for(int i=1;i<(N+1)/2;i++){
MinMax(mn+1,mx-1,&mn1,&mx1);
if(mn1==-1) break;
pas=max(pas,max(mn1-mn,mx-mx1));
mx=mx1;
mn=mn1;
}
return max(pas,mx-mn);
}
while(1){
if(mn>=mx) break;
MinMax(mn+1,mn+1+xr,&mn1,&mx1);
if(mn1==-1) {xr*=2;continue;}
pas=max(pas,mn1-mn);
mn=mn1;
}
return pas;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
504 KB |
Output is correct |
2 |
Correct |
2 ms |
504 KB |
Output is correct |
3 |
Correct |
2 ms |
552 KB |
Output is correct |
4 |
Correct |
2 ms |
572 KB |
Output is correct |
5 |
Correct |
2 ms |
576 KB |
Output is correct |
6 |
Correct |
2 ms |
716 KB |
Output is correct |
7 |
Correct |
2 ms |
716 KB |
Output is correct |
8 |
Correct |
2 ms |
864 KB |
Output is correct |
9 |
Correct |
2 ms |
864 KB |
Output is correct |
10 |
Correct |
2 ms |
864 KB |
Output is correct |
11 |
Correct |
2 ms |
864 KB |
Output is correct |
12 |
Correct |
2 ms |
864 KB |
Output is correct |
13 |
Correct |
2 ms |
924 KB |
Output is correct |
14 |
Correct |
2 ms |
968 KB |
Output is correct |
15 |
Correct |
2 ms |
1016 KB |
Output is correct |
16 |
Correct |
15 ms |
1668 KB |
Output is correct |
17 |
Correct |
15 ms |
2100 KB |
Output is correct |
18 |
Correct |
15 ms |
2532 KB |
Output is correct |
19 |
Correct |
15 ms |
3084 KB |
Output is correct |
20 |
Correct |
11 ms |
3268 KB |
Output is correct |
21 |
Correct |
55 ms |
5616 KB |
Output is correct |
22 |
Correct |
55 ms |
7500 KB |
Output is correct |
23 |
Correct |
55 ms |
9412 KB |
Output is correct |
24 |
Correct |
56 ms |
11188 KB |
Output is correct |
25 |
Correct |
47 ms |
12452 KB |
Output is correct |
26 |
Correct |
56 ms |
14320 KB |
Output is correct |
27 |
Correct |
55 ms |
16096 KB |
Output is correct |
28 |
Correct |
56 ms |
17980 KB |
Output is correct |
29 |
Correct |
55 ms |
19780 KB |
Output is correct |
30 |
Correct |
41 ms |
20568 KB |
Output is correct |
31 |
Correct |
2 ms |
20568 KB |
Output is correct |
32 |
Correct |
2 ms |
20568 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
2 ms |
20568 KB |
Partially correct |
2 |
Partially correct |
2 ms |
20568 KB |
Partially correct |
3 |
Partially correct |
2 ms |
20568 KB |
Partially correct |
4 |
Partially correct |
2 ms |
20568 KB |
Partially correct |
5 |
Partially correct |
2 ms |
20568 KB |
Partially correct |
6 |
Partially correct |
2 ms |
20568 KB |
Partially correct |
7 |
Partially correct |
2 ms |
20568 KB |
Partially correct |
8 |
Partially correct |
2 ms |
20568 KB |
Partially correct |
9 |
Partially correct |
2 ms |
20568 KB |
Partially correct |
10 |
Partially correct |
2 ms |
20568 KB |
Partially correct |
11 |
Partially correct |
3 ms |
20568 KB |
Partially correct |
12 |
Partially correct |
3 ms |
20568 KB |
Partially correct |
13 |
Partially correct |
3 ms |
20568 KB |
Partially correct |
14 |
Partially correct |
3 ms |
20568 KB |
Partially correct |
15 |
Partially correct |
3 ms |
20568 KB |
Partially correct |
16 |
Partially correct |
20 ms |
20652 KB |
Partially correct |
17 |
Partially correct |
21 ms |
21088 KB |
Partially correct |
18 |
Partially correct |
20 ms |
21528 KB |
Partially correct |
19 |
Partially correct |
20 ms |
22012 KB |
Partially correct |
20 |
Partially correct |
14 ms |
22192 KB |
Partially correct |
21 |
Partially correct |
79 ms |
24536 KB |
Partially correct |
22 |
Partially correct |
78 ms |
26436 KB |
Partially correct |
23 |
Partially correct |
78 ms |
28256 KB |
Partially correct |
24 |
Partially correct |
79 ms |
30096 KB |
Partially correct |
25 |
Partially correct |
69 ms |
31300 KB |
Partially correct |
26 |
Partially correct |
79 ms |
33172 KB |
Partially correct |
27 |
Partially correct |
79 ms |
35144 KB |
Partially correct |
28 |
Partially correct |
79 ms |
36988 KB |
Partially correct |
29 |
Partially correct |
79 ms |
38720 KB |
Partially correct |
30 |
Partially correct |
58 ms |
39416 KB |
Partially correct |
31 |
Partially correct |
2 ms |
39416 KB |
Partially correct |
32 |
Partially correct |
2 ms |
39416 KB |
Partially correct |