#include "gap.h"
#include "bits/stdc++.h"
using namespace std;
long long findGap(int T, int N) {
long long ret = 0;
vector<long long> a(N + 1);
MinMax(0, LLONG_MAX, &a[1], &a[N]);
for (int i = 1; i < N - 1; ++i) {//find i + 1
long long s = (a[N] - a[i] + N - i - 1) / (N - i) - 1;
long long z = 0;
MinMax(a[i] + 1, a[i] + s, &z, &z);
if (z == -1) {
long long t = 0;
for (int j = 60; (1LL << j) >= ret; --j) {
if ((1LL << j) > a[N]) {
continue;
}
MinMax(a[i] + 1, a[i] + t + (1LL << j), &z, &z);
if (z == -1) {
t += (1 << j);
}
}
ret = max(ret, t + 1);
a[i + 1] = a[i] + t + 1;
} else {
a[i + 1] = z;
if (z == a[N]) {
break;
}
}
}
ret = max(ret, a[N] - a[N - 1]);
return ret;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Runtime error |
0 ms |
2392 KB |
Execution failed because the return code was nonzero |
3 |
Runtime error |
1 ms |
2544 KB |
Execution failed because the return code was nonzero |
4 |
Runtime error |
0 ms |
2392 KB |
Execution failed because the return code was nonzero |
5 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
6 |
Runtime error |
1 ms |
2392 KB |
Execution failed because the return code was nonzero |
7 |
Runtime error |
1 ms |
2392 KB |
Execution failed because the return code was nonzero |
8 |
Runtime error |
1 ms |
2392 KB |
Execution failed because the return code was nonzero |
9 |
Runtime error |
0 ms |
2392 KB |
Execution failed because the return code was nonzero |
10 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
11 |
Runtime error |
1 ms |
2392 KB |
Execution failed because the return code was nonzero |
12 |
Runtime error |
2 ms |
2392 KB |
Execution failed because the return code was nonzero |
13 |
Runtime error |
2 ms |
2392 KB |
Execution failed because the return code was nonzero |
14 |
Runtime error |
1 ms |
2392 KB |
Execution failed because the return code was nonzero |
15 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
16 |
Runtime error |
4 ms |
2584 KB |
Execution failed because the return code was nonzero |
17 |
Runtime error |
6 ms |
2584 KB |
Execution failed because the return code was nonzero |
18 |
Runtime error |
3 ms |
2588 KB |
Execution failed because the return code was nonzero |
19 |
Runtime error |
4 ms |
2584 KB |
Execution failed because the return code was nonzero |
20 |
Incorrect |
8 ms |
2648 KB |
Output isn't correct |
21 |
Runtime error |
12 ms |
3624 KB |
Execution failed because the return code was nonzero |
22 |
Runtime error |
12 ms |
3624 KB |
Execution failed because the return code was nonzero |
23 |
Runtime error |
12 ms |
3620 KB |
Execution failed because the return code was nonzero |
24 |
Runtime error |
12 ms |
3616 KB |
Execution failed because the return code was nonzero |
25 |
Incorrect |
37 ms |
3620 KB |
Output isn't correct |
26 |
Runtime error |
13 ms |
3604 KB |
Execution failed because the return code was nonzero |
27 |
Runtime error |
12 ms |
3628 KB |
Execution failed because the return code was nonzero |
28 |
Runtime error |
12 ms |
3572 KB |
Execution failed because the return code was nonzero |
29 |
Runtime error |
13 ms |
3624 KB |
Execution failed because the return code was nonzero |
30 |
Incorrect |
57 ms |
3620 KB |
Output isn't correct |
31 |
Runtime error |
0 ms |
2392 KB |
Execution failed because the return code was nonzero |
32 |
Runtime error |
0 ms |
2392 KB |
Execution failed because the return code was nonzero |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2484 KB |
Output is correct |
2 |
Runtime error |
1 ms |
2392 KB |
Execution failed because the return code was nonzero |
3 |
Runtime error |
0 ms |
2392 KB |
Execution failed because the return code was nonzero |
4 |
Runtime error |
0 ms |
2392 KB |
Execution failed because the return code was nonzero |
5 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
6 |
Runtime error |
0 ms |
2392 KB |
Execution failed because the return code was nonzero |
7 |
Runtime error |
0 ms |
2392 KB |
Execution failed because the return code was nonzero |
8 |
Runtime error |
1 ms |
2392 KB |
Execution failed because the return code was nonzero |
9 |
Runtime error |
0 ms |
2392 KB |
Execution failed because the return code was nonzero |
10 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
11 |
Runtime error |
2 ms |
2392 KB |
Execution failed because the return code was nonzero |
12 |
Runtime error |
1 ms |
2392 KB |
Execution failed because the return code was nonzero |
13 |
Runtime error |
1 ms |
2392 KB |
Execution failed because the return code was nonzero |
14 |
Runtime error |
1 ms |
2392 KB |
Execution failed because the return code was nonzero |
15 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
16 |
Runtime error |
3 ms |
2584 KB |
Execution failed because the return code was nonzero |
17 |
Runtime error |
4 ms |
2752 KB |
Execution failed because the return code was nonzero |
18 |
Runtime error |
3 ms |
2588 KB |
Execution failed because the return code was nonzero |
19 |
Runtime error |
4 ms |
2752 KB |
Execution failed because the return code was nonzero |
20 |
Incorrect |
8 ms |
2568 KB |
Output isn't correct |
21 |
Runtime error |
17 ms |
3628 KB |
Execution failed because the return code was nonzero |
22 |
Runtime error |
12 ms |
3624 KB |
Execution failed because the return code was nonzero |
23 |
Runtime error |
12 ms |
3612 KB |
Execution failed because the return code was nonzero |
24 |
Runtime error |
12 ms |
3628 KB |
Execution failed because the return code was nonzero |
25 |
Incorrect |
37 ms |
3616 KB |
Output isn't correct |
26 |
Runtime error |
13 ms |
3624 KB |
Execution failed because the return code was nonzero |
27 |
Runtime error |
12 ms |
3628 KB |
Execution failed because the return code was nonzero |
28 |
Runtime error |
12 ms |
3624 KB |
Execution failed because the return code was nonzero |
29 |
Runtime error |
14 ms |
3620 KB |
Execution failed because the return code was nonzero |
30 |
Incorrect |
47 ms |
3624 KB |
Expected int32, but "7684906678" found |
31 |
Runtime error |
1 ms |
2392 KB |
Execution failed because the return code was nonzero |
32 |
Runtime error |
1 ms |
2392 KB |
Execution failed because the return code was nonzero |