#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
#define int long long
int dnc(int l, int r){
if (l>=r) return 0;
int mid=(l+r)>>1;
int l1, r1, l2, r2;
MinMax(l, mid, &l1, &r1);
MinMax(mid+1, r, &l2, &r2);
int ll=l1;
if (ll==-1) ll=l2;
int rr=r2;
if (rr==-1) rr=r1;
if (ll==-1 || rr==-1) return r-l+2;
return max({(r+1)-rr, ll-(l-1), l2-r1, dnc(l1+1, r1-1), dnc(l2+1, r2-1)});
}
long long findGap(int32_t T, int32_t N)
{
int l, r;
MinMax(0, 1e18, &l, &r);
if (N==2) return r-l;
return dnc(l+1, r-1);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
3 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
4 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
6 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
8 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
9 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
10 |
Correct |
1 ms |
2392 KB |
Output is correct |
11 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
12 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
13 |
Incorrect |
2 ms |
2392 KB |
Output isn't correct |
14 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
15 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
16 |
Incorrect |
11 ms |
2592 KB |
Output isn't correct |
17 |
Incorrect |
10 ms |
2584 KB |
Output isn't correct |
18 |
Incorrect |
11 ms |
2752 KB |
Output isn't correct |
19 |
Incorrect |
11 ms |
2556 KB |
Output isn't correct |
20 |
Correct |
7 ms |
2572 KB |
Output is correct |
21 |
Incorrect |
42 ms |
2860 KB |
Output isn't correct |
22 |
Incorrect |
43 ms |
2856 KB |
Output isn't correct |
23 |
Incorrect |
45 ms |
2900 KB |
Output isn't correct |
24 |
Incorrect |
43 ms |
2864 KB |
Output isn't correct |
25 |
Incorrect |
36 ms |
2848 KB |
Output isn't correct |
26 |
Incorrect |
43 ms |
2860 KB |
Output isn't correct |
27 |
Incorrect |
43 ms |
2864 KB |
Output isn't correct |
28 |
Incorrect |
42 ms |
3092 KB |
Output isn't correct |
29 |
Incorrect |
42 ms |
2852 KB |
Output isn't correct |
30 |
Correct |
30 ms |
2848 KB |
Output is correct |
31 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
32 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
3 |
Partially correct |
1 ms |
2392 KB |
Partially correct |
4 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
5 |
Partially correct |
0 ms |
2392 KB |
Partially correct |
6 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
7 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
9 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
10 |
Partially correct |
1 ms |
2392 KB |
Partially correct |
11 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
12 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
13 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
14 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
15 |
Partially correct |
1 ms |
2392 KB |
Partially correct |
16 |
Incorrect |
11 ms |
2580 KB |
Output isn't correct |
17 |
Incorrect |
11 ms |
2584 KB |
Output isn't correct |
18 |
Incorrect |
11 ms |
2584 KB |
Output isn't correct |
19 |
Incorrect |
11 ms |
2584 KB |
Output isn't correct |
20 |
Partially correct |
8 ms |
2580 KB |
Partially correct |
21 |
Incorrect |
46 ms |
2856 KB |
Output isn't correct |
22 |
Incorrect |
42 ms |
2864 KB |
Output isn't correct |
23 |
Incorrect |
44 ms |
2856 KB |
Output isn't correct |
24 |
Incorrect |
44 ms |
2944 KB |
Output isn't correct |
25 |
Partially correct |
36 ms |
2860 KB |
Partially correct |
26 |
Incorrect |
42 ms |
2856 KB |
Output isn't correct |
27 |
Incorrect |
42 ms |
2860 KB |
Output isn't correct |
28 |
Incorrect |
46 ms |
3084 KB |
Output isn't correct |
29 |
Incorrect |
43 ms |
3108 KB |
Output isn't correct |
30 |
Partially correct |
29 ms |
2840 KB |
Partially correct |
31 |
Partially correct |
1 ms |
2644 KB |
Partially correct |
32 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |