#include <bits/stdc++.h>
#include "gap.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
ll ans[100005];
long long findGap(int T, int N) {
ll l = 0, r = 1e18 + 500;
ll mn, mx;
MinMax(l, r, &mn, &mx);
l = mn, r = mx;
ll len = (r - 1) - (l + 1) + 1;
if (N == 2) return r - l;
ll idx = l + 1, add = len / (N - 2);
ll ret = 0;
for (int i = 0; i < N - 2; i++) {
if (i == N - 3) {
MinMax(idx, r - 1, &mn, &mx);
if (mn == -1 && mx == -1) continue;
ret = max(ret, mn - l);
ret = max(ret, mx - mn);
ret = max(ret, r - mx);
} else {
MinMax(idx, idx + add - 1, &mn, &mx);
if (mn == -1 && mx == -1) continue;
ret = max(ret, mn - l);
ret = max(ret, mx - mn);
l = mx;
}
idx += add;
}
return ret;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
7 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
10 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
12 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
13 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
14 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
15 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
16 |
Incorrect |
6 ms |
596 KB |
Output isn't correct |
17 |
Incorrect |
8 ms |
440 KB |
Output isn't correct |
18 |
Incorrect |
6 ms |
600 KB |
Output isn't correct |
19 |
Incorrect |
6 ms |
600 KB |
Output isn't correct |
20 |
Incorrect |
5 ms |
600 KB |
Output isn't correct |
21 |
Incorrect |
24 ms |
1104 KB |
Output isn't correct |
22 |
Incorrect |
32 ms |
1112 KB |
Output isn't correct |
23 |
Incorrect |
24 ms |
1112 KB |
Output isn't correct |
24 |
Incorrect |
24 ms |
1112 KB |
Output isn't correct |
25 |
Incorrect |
34 ms |
1132 KB |
Output isn't correct |
26 |
Incorrect |
31 ms |
1112 KB |
Output isn't correct |
27 |
Incorrect |
24 ms |
1112 KB |
Output isn't correct |
28 |
Incorrect |
23 ms |
1120 KB |
Output isn't correct |
29 |
Incorrect |
24 ms |
1112 KB |
Output isn't correct |
30 |
Incorrect |
27 ms |
1112 KB |
Output isn't correct |
31 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
32 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
9 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
10 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
12 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
13 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
14 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
15 |
Correct |
1 ms |
344 KB |
Output is correct |
16 |
Incorrect |
6 ms |
600 KB |
Output isn't correct |
17 |
Incorrect |
8 ms |
600 KB |
Output isn't correct |
18 |
Incorrect |
6 ms |
600 KB |
Output isn't correct |
19 |
Incorrect |
6 ms |
588 KB |
Output isn't correct |
20 |
Incorrect |
5 ms |
656 KB |
Output isn't correct |
21 |
Incorrect |
23 ms |
1112 KB |
Output isn't correct |
22 |
Incorrect |
23 ms |
1112 KB |
Output isn't correct |
23 |
Incorrect |
27 ms |
1112 KB |
Output isn't correct |
24 |
Incorrect |
29 ms |
1112 KB |
Output isn't correct |
25 |
Correct |
40 ms |
1112 KB |
Output is correct |
26 |
Incorrect |
27 ms |
1112 KB |
Output isn't correct |
27 |
Incorrect |
23 ms |
1112 KB |
Output isn't correct |
28 |
Incorrect |
23 ms |
1160 KB |
Output isn't correct |
29 |
Incorrect |
24 ms |
1112 KB |
Output isn't correct |
30 |
Incorrect |
19 ms |
1112 KB |
Output isn't correct |
31 |
Correct |
0 ms |
344 KB |
Output is correct |
32 |
Correct |
0 ms |
344 KB |
Output is correct |