# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
745191 |
2023-05-19T14:28:03 Z |
viwlesxq |
Gap (APIO16_gap) |
C++17 |
|
61 ms |
1956 KB |
#include "gap.h"
#include <bits/stdc++.h>
typedef long long ll;
ll Min, Max, s, t;
ll findGap(int T, int N) {
if (T == 1) {
s = 0, t = 1e18;
ll arr[N];
int l = 0, r = N - 1;
while (l <= r) {
MinMax(s, t, &Min, &Max);
arr[l] = Min, arr[r] = Max;
s = Min + 1, t = Max - 1;
l++, --r;
}
ll ans = 0;
for (int i = 1; i < N; ++i) {
ans = std::max(ans, arr[i] - arr[i - 1]);
}
return ans;
} else {
s = 0, t = 1e18;
MinMax(s, t, &Min, &Max);
ll step = (Max - Min + N - 2) / (N - 1);
ll l = Min, i, x, y, ans = step;
for (i = Min; i + step < Max; i += step + 1) {
MinMax(i, i + step, &x, &y);
if (x != -1) {
ans = std::max(ans, x - l);
l = y;
}
}
MinMax(i, Max, &x, &y);
if (x != -1) {
ans = std::max(ans, x - l);
}
return ans;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
208 KB |
Output is correct |
6 |
Correct |
0 ms |
208 KB |
Output is correct |
7 |
Correct |
0 ms |
208 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
0 ms |
208 KB |
Output is correct |
10 |
Correct |
1 ms |
208 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
336 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
9 ms |
592 KB |
Output is correct |
17 |
Correct |
10 ms |
684 KB |
Output is correct |
18 |
Correct |
10 ms |
632 KB |
Output is correct |
19 |
Correct |
10 ms |
688 KB |
Output is correct |
20 |
Correct |
7 ms |
592 KB |
Output is correct |
21 |
Correct |
42 ms |
1824 KB |
Output is correct |
22 |
Correct |
35 ms |
1828 KB |
Output is correct |
23 |
Correct |
37 ms |
1864 KB |
Output is correct |
24 |
Correct |
41 ms |
1956 KB |
Output is correct |
25 |
Correct |
31 ms |
1852 KB |
Output is correct |
26 |
Correct |
34 ms |
1756 KB |
Output is correct |
27 |
Correct |
38 ms |
1828 KB |
Output is correct |
28 |
Correct |
37 ms |
1868 KB |
Output is correct |
29 |
Correct |
35 ms |
1752 KB |
Output is correct |
30 |
Correct |
29 ms |
1840 KB |
Output is correct |
31 |
Correct |
1 ms |
208 KB |
Output is correct |
32 |
Correct |
0 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
208 KB |
Output is correct |
6 |
Correct |
1 ms |
208 KB |
Output is correct |
7 |
Correct |
0 ms |
208 KB |
Output is correct |
8 |
Correct |
1 ms |
208 KB |
Output is correct |
9 |
Correct |
0 ms |
208 KB |
Output is correct |
10 |
Correct |
1 ms |
208 KB |
Output is correct |
11 |
Correct |
1 ms |
208 KB |
Output is correct |
12 |
Correct |
1 ms |
208 KB |
Output is correct |
13 |
Correct |
1 ms |
208 KB |
Output is correct |
14 |
Correct |
1 ms |
328 KB |
Output is correct |
15 |
Correct |
1 ms |
208 KB |
Output is correct |
16 |
Correct |
13 ms |
420 KB |
Output is correct |
17 |
Correct |
12 ms |
432 KB |
Output is correct |
18 |
Correct |
12 ms |
424 KB |
Output is correct |
19 |
Correct |
12 ms |
464 KB |
Output is correct |
20 |
Correct |
7 ms |
464 KB |
Output is correct |
21 |
Correct |
61 ms |
1080 KB |
Output is correct |
22 |
Correct |
58 ms |
1116 KB |
Output is correct |
23 |
Correct |
51 ms |
1056 KB |
Output is correct |
24 |
Correct |
55 ms |
1076 KB |
Output is correct |
25 |
Correct |
48 ms |
1112 KB |
Output is correct |
26 |
Correct |
52 ms |
960 KB |
Output is correct |
27 |
Correct |
50 ms |
1052 KB |
Output is correct |
28 |
Correct |
58 ms |
1056 KB |
Output is correct |
29 |
Correct |
49 ms |
968 KB |
Output is correct |
30 |
Correct |
26 ms |
1052 KB |
Output is correct |
31 |
Correct |
0 ms |
208 KB |
Output is correct |
32 |
Correct |
1 ms |
208 KB |
Output is correct |