#include <bits/stdc++.h>
#include "gap.h"
using namespace std;
int n;
set<long long> setas;
void calc(long long L, long long R) {
if(L > R) return ;
long long mn, mx;
MinMax(L, R, &mn, &mx);
if(mn == -1) return ;
long long mid = (L + R) / 2;
long long MX = mx;
long long sk = -1;
MinMax(mid, R, &mn, &mx);
if(mn == -1) {
sk = MX;
calc(L, MX-1);
}else {
sk = mn;
calc(L, sk-1);
calc(mid+1, mx-1);
setas.insert(mx);
}
setas.insert(sk);
}
long long findGap(int T, int N) {
n = N;
long long L = 0, R = 1e18;
calc(L, R);
vector<long long> mas;
for(auto x : setas) mas.push_back(x);
long long ans = 0;
for(int i = 0; i < n-1; i++) {
ans = max(ans, mas[i+1] - mas[i]);
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
208 KB |
Output isn't correct |
3 |
Incorrect |
1 ms |
208 KB |
Output isn't correct |
4 |
Incorrect |
1 ms |
208 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
6 |
Incorrect |
1 ms |
208 KB |
Output isn't correct |
7 |
Incorrect |
1 ms |
208 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
208 KB |
Output isn't correct |
9 |
Incorrect |
1 ms |
208 KB |
Output isn't correct |
10 |
Incorrect |
1 ms |
208 KB |
Output isn't correct |
11 |
Incorrect |
2 ms |
336 KB |
Output isn't correct |
12 |
Incorrect |
3 ms |
336 KB |
Output isn't correct |
13 |
Incorrect |
2 ms |
336 KB |
Output isn't correct |
14 |
Incorrect |
2 ms |
336 KB |
Output isn't correct |
15 |
Incorrect |
2 ms |
332 KB |
Output isn't correct |
16 |
Incorrect |
41 ms |
1960 KB |
Output isn't correct |
17 |
Incorrect |
33 ms |
2020 KB |
Output isn't correct |
18 |
Incorrect |
40 ms |
2056 KB |
Output isn't correct |
19 |
Incorrect |
33 ms |
2024 KB |
Output isn't correct |
20 |
Incorrect |
21 ms |
1972 KB |
Output isn't correct |
21 |
Incorrect |
140 ms |
6824 KB |
Output isn't correct |
22 |
Incorrect |
158 ms |
6872 KB |
Output isn't correct |
23 |
Incorrect |
138 ms |
6888 KB |
Output isn't correct |
24 |
Incorrect |
154 ms |
6884 KB |
Output isn't correct |
25 |
Incorrect |
153 ms |
6924 KB |
Output isn't correct |
26 |
Incorrect |
163 ms |
6824 KB |
Output isn't correct |
27 |
Incorrect |
155 ms |
6904 KB |
Output isn't correct |
28 |
Incorrect |
151 ms |
6940 KB |
Output isn't correct |
29 |
Incorrect |
163 ms |
6932 KB |
Output isn't correct |
30 |
Incorrect |
90 ms |
6840 KB |
Output isn't correct |
31 |
Incorrect |
1 ms |
208 KB |
Output isn't correct |
32 |
Incorrect |
1 ms |
208 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
208 KB |
Partially correct |
2 |
Partially correct |
0 ms |
208 KB |
Partially correct |
3 |
Partially correct |
0 ms |
208 KB |
Partially correct |
4 |
Partially correct |
0 ms |
208 KB |
Partially correct |
5 |
Partially correct |
1 ms |
212 KB |
Partially correct |
6 |
Partially correct |
0 ms |
208 KB |
Partially correct |
7 |
Partially correct |
1 ms |
212 KB |
Partially correct |
8 |
Partially correct |
1 ms |
208 KB |
Partially correct |
9 |
Partially correct |
1 ms |
208 KB |
Partially correct |
10 |
Partially correct |
1 ms |
208 KB |
Partially correct |
11 |
Partially correct |
2 ms |
336 KB |
Partially correct |
12 |
Partially correct |
2 ms |
340 KB |
Partially correct |
13 |
Partially correct |
2 ms |
336 KB |
Partially correct |
14 |
Partially correct |
3 ms |
336 KB |
Partially correct |
15 |
Partially correct |
2 ms |
336 KB |
Partially correct |
16 |
Partially correct |
34 ms |
2064 KB |
Partially correct |
17 |
Partially correct |
42 ms |
2004 KB |
Partially correct |
18 |
Partially correct |
32 ms |
1996 KB |
Partially correct |
19 |
Partially correct |
39 ms |
1964 KB |
Partially correct |
20 |
Partially correct |
24 ms |
1964 KB |
Partially correct |
21 |
Partially correct |
164 ms |
6924 KB |
Partially correct |
22 |
Partially correct |
144 ms |
6948 KB |
Partially correct |
23 |
Partially correct |
166 ms |
6940 KB |
Partially correct |
24 |
Partially correct |
167 ms |
6852 KB |
Partially correct |
25 |
Partially correct |
131 ms |
6916 KB |
Partially correct |
26 |
Partially correct |
169 ms |
6860 KB |
Partially correct |
27 |
Partially correct |
162 ms |
6956 KB |
Partially correct |
28 |
Partially correct |
159 ms |
6828 KB |
Partially correct |
29 |
Partially correct |
166 ms |
6932 KB |
Partially correct |
30 |
Partially correct |
93 ms |
6884 KB |
Partially correct |
31 |
Partially correct |
0 ms |
208 KB |
Partially correct |
32 |
Partially correct |
1 ms |
208 KB |
Partially correct |