// Why am I so stupid? :c
#include <bits/stdc++.h>
#include "gap.h"
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
typedef long long ll;
using namespace std;
long long findGap(int t, int n) {
ll arr[n + 5], que[2], ret = 0;
int sz = 0;
if (n <= 5) {
arr[0] = 0, arr[n + 1] = (ll)1e18 + 1;
int l = 1, r = n;
while (l <= r) {
MinMax(arr[l - 1] + 1, arr[r + 1] - 1, arr + l, arr + r);
++l, --r;
}
for (int i = 1; i < n; ++i) {
ret = max(ret, arr[i + 1] - arr[i]);
}
}
else {
MinMax(1, (ll)1e18, que, que + 1);
ll l = que[0], r = que[1];
arr[++sz] = l++;
arr[++sz] = r--;
ll a = (r - l + 1) / (n - 1);
ll b = (r - l + 1) % (n - 1);
ll cur = l;
for (int i = 1; i < n; ++i) {
ll len = a;
if (b > 0) {
++len, --b;
}
MinMax(cur, cur + len - 1, que, que + 1);
if (que[0] != -1) {
arr[++sz] = que[0];
arr[++sz] = que[1];
}
}
sort(arr + 1, arr + sz + 1);
for (int i = 1; i < sz; ++i) {
ret = max(ret, arr[i + 1] - arr[i]);
}
}
return ret;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Incorrect |
2 ms |
484 KB |
Output isn't correct |
3 |
Runtime error |
2 ms |
696 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
4 |
Runtime error |
2 ms |
704 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
5 |
Runtime error |
2 ms |
812 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
6 |
Incorrect |
2 ms |
812 KB |
Output isn't correct |
7 |
Runtime error |
2 ms |
820 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
8 |
Runtime error |
2 ms |
904 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
9 |
Incorrect |
2 ms |
948 KB |
Output isn't correct |
10 |
Runtime error |
2 ms |
952 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
11 |
Incorrect |
2 ms |
952 KB |
Output isn't correct |
12 |
Runtime error |
3 ms |
952 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
13 |
Runtime error |
3 ms |
1052 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
14 |
Incorrect |
2 ms |
1052 KB |
Output isn't correct |
15 |
Runtime error |
3 ms |
1052 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
16 |
Runtime error |
12 ms |
1600 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
17 |
Incorrect |
13 ms |
1600 KB |
Output isn't correct |
18 |
Incorrect |
13 ms |
1600 KB |
Output isn't correct |
19 |
Incorrect |
13 ms |
1600 KB |
Output isn't correct |
20 |
Runtime error |
8 ms |
1720 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
21 |
Incorrect |
48 ms |
2200 KB |
Output isn't correct |
22 |
Runtime error |
40 ms |
4024 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
23 |
Incorrect |
48 ms |
4024 KB |
Output isn't correct |
24 |
Runtime error |
74 ms |
4132 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
25 |
Runtime error |
45 ms |
5176 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
26 |
Incorrect |
49 ms |
5176 KB |
Output isn't correct |
27 |
Runtime error |
42 ms |
5176 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
28 |
Runtime error |
42 ms |
5176 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
29 |
Incorrect |
50 ms |
5176 KB |
Output isn't correct |
30 |
Runtime error |
27 ms |
5176 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
31 |
Runtime error |
3 ms |
5176 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
32 |
Incorrect |
2 ms |
5176 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
5176 KB |
Output is correct |
2 |
Runtime error |
2 ms |
5176 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Incorrect |
2 ms |
5176 KB |
Output isn't correct |
4 |
Runtime error |
2 ms |
5176 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
5 |
Runtime error |
2 ms |
5176 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
6 |
Incorrect |
2 ms |
5176 KB |
Output isn't correct |
7 |
Runtime error |
2 ms |
5176 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
8 |
Incorrect |
2 ms |
5176 KB |
Output isn't correct |
9 |
Runtime error |
3 ms |
5176 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
10 |
Runtime error |
2 ms |
5176 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
11 |
Runtime error |
4 ms |
5176 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
12 |
Incorrect |
3 ms |
5176 KB |
Output isn't correct |
13 |
Incorrect |
3 ms |
5176 KB |
Output isn't correct |
14 |
Runtime error |
3 ms |
5176 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
15 |
Runtime error |
4 ms |
5176 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
16 |
Runtime error |
12 ms |
5176 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
17 |
Runtime error |
12 ms |
5176 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
18 |
Incorrect |
13 ms |
5176 KB |
Output isn't correct |
19 |
Runtime error |
12 ms |
5176 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
20 |
Runtime error |
8 ms |
5176 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
21 |
Runtime error |
41 ms |
5176 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
22 |
Incorrect |
48 ms |
5176 KB |
Output isn't correct |
23 |
Incorrect |
48 ms |
5176 KB |
Output isn't correct |
24 |
Runtime error |
41 ms |
5176 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
25 |
Runtime error |
46 ms |
5196 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
26 |
Incorrect |
47 ms |
5196 KB |
Output isn't correct |
27 |
Incorrect |
47 ms |
5196 KB |
Output isn't correct |
28 |
Incorrect |
47 ms |
5196 KB |
Output isn't correct |
29 |
Runtime error |
41 ms |
5196 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
30 |
Runtime error |
27 ms |
5196 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
31 |
Runtime error |
2 ms |
5196 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
32 |
Incorrect |
2 ms |
5196 KB |
Output isn't correct |