# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
400126 |
2021-05-07T11:38:12 Z |
dxz05 |
Gap (APIO16_gap) |
C++14 |
|
61 ms |
1876 KB |
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 555555;
const long long INF = 1e18 + 2e2;
typedef long long ll;
ll a[MAXN];
long long findGap(int SUBTASK, int n){
if (SUBTASK == 1){
ll mn = 0, mx = 1e18;
for (int i = 1; i <= (n + 1) / 2; i++){
MinMax(mn, mx, &a[i], &a[n - i + 1]);
mn = a[i] + 1;
mx = a[n - i + 1] - 1;
}
ll ans = 0;
for (int i = 1; i < n; i++) ans = max(ans, a[i + 1] - a[i]);
return ans;
} else {
ll mn, mx;
MinMax(0, INF, &mn, &mx);
a[1] = mn;
a[n] = mx;
ll x = (mx - mn + n - 2) / (n - 1) + 1;
ll ans = x - 1;
ll l = mn + 1, last = mn;
while (last + x < a[n]){
MinMax(l, l + x - 1, &mn, &mx);
if (mn == -1){
l += x;
} else {
ans = max(ans, mn - last);
last = mx;
l = last + 1;
}
x = max(ans, x + 1);
}
return ans;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Correct |
1 ms |
328 KB |
Output is correct |
4 |
Correct |
1 ms |
328 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
1 ms |
200 KB |
Output is correct |
7 |
Correct |
1 ms |
200 KB |
Output is correct |
8 |
Correct |
1 ms |
200 KB |
Output is correct |
9 |
Correct |
1 ms |
200 KB |
Output is correct |
10 |
Correct |
1 ms |
200 KB |
Output is correct |
11 |
Correct |
1 ms |
328 KB |
Output is correct |
12 |
Correct |
1 ms |
328 KB |
Output is correct |
13 |
Correct |
1 ms |
328 KB |
Output is correct |
14 |
Correct |
1 ms |
328 KB |
Output is correct |
15 |
Correct |
1 ms |
328 KB |
Output is correct |
16 |
Correct |
11 ms |
668 KB |
Output is correct |
17 |
Correct |
11 ms |
584 KB |
Output is correct |
18 |
Correct |
11 ms |
636 KB |
Output is correct |
19 |
Correct |
11 ms |
624 KB |
Output is correct |
20 |
Correct |
9 ms |
584 KB |
Output is correct |
21 |
Correct |
46 ms |
1740 KB |
Output is correct |
22 |
Correct |
44 ms |
1856 KB |
Output is correct |
23 |
Correct |
43 ms |
1856 KB |
Output is correct |
24 |
Correct |
50 ms |
1784 KB |
Output is correct |
25 |
Correct |
38 ms |
1840 KB |
Output is correct |
26 |
Correct |
43 ms |
1876 KB |
Output is correct |
27 |
Correct |
61 ms |
1784 KB |
Output is correct |
28 |
Correct |
43 ms |
1752 KB |
Output is correct |
29 |
Correct |
42 ms |
1796 KB |
Output is correct |
30 |
Correct |
35 ms |
1836 KB |
Output is correct |
31 |
Correct |
1 ms |
200 KB |
Output is correct |
32 |
Correct |
1 ms |
328 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Correct |
1 ms |
200 KB |
Output is correct |
4 |
Correct |
1 ms |
324 KB |
Output is correct |
5 |
Correct |
1 ms |
200 KB |
Output is correct |
6 |
Correct |
1 ms |
200 KB |
Output is correct |
7 |
Correct |
1 ms |
200 KB |
Output is correct |
8 |
Correct |
1 ms |
200 KB |
Output is correct |
9 |
Correct |
1 ms |
328 KB |
Output is correct |
10 |
Correct |
1 ms |
200 KB |
Output is correct |
11 |
Correct |
1 ms |
328 KB |
Output is correct |
12 |
Correct |
1 ms |
328 KB |
Output is correct |
13 |
Correct |
1 ms |
332 KB |
Output is correct |
14 |
Correct |
1 ms |
328 KB |
Output is correct |
15 |
Correct |
2 ms |
328 KB |
Output is correct |
16 |
Correct |
8 ms |
456 KB |
Output is correct |
17 |
Correct |
8 ms |
456 KB |
Output is correct |
18 |
Correct |
8 ms |
424 KB |
Output is correct |
19 |
Correct |
8 ms |
456 KB |
Output is correct |
20 |
Correct |
4 ms |
456 KB |
Output is correct |
21 |
Correct |
30 ms |
1024 KB |
Output is correct |
22 |
Correct |
28 ms |
1088 KB |
Output is correct |
23 |
Correct |
33 ms |
1056 KB |
Output is correct |
24 |
Correct |
27 ms |
1016 KB |
Output is correct |
25 |
Correct |
54 ms |
1000 KB |
Output is correct |
26 |
Correct |
28 ms |
1060 KB |
Output is correct |
27 |
Correct |
29 ms |
984 KB |
Output is correct |
28 |
Correct |
29 ms |
1088 KB |
Output is correct |
29 |
Correct |
29 ms |
1048 KB |
Output is correct |
30 |
Correct |
14 ms |
1096 KB |
Output is correct |
31 |
Correct |
1 ms |
200 KB |
Output is correct |
32 |
Correct |
1 ms |
332 KB |
Output is correct |