# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
956282 |
2024-04-01T13:46:20 Z |
Nelt |
Gap (APIO16_gap) |
C++17 |
|
537 ms |
3872 KB |
#include "gap.h"
#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
using namespace std;
ll findGap(int t, int n)
{
if (t == 1)
{
ll ans = 0;
ll a[n];
ll l = 0, r = 1e18, i = 0, j = n - 1;
while (i <= j)
{
MinMax(l, r, &a[i], &a[j]);
l = a[i++] + 1;
r = a[j--] - 1;
}
for (ll i = 0; i + 1 < n; i++)
ans = max(ans, a[i + 1] - a[i]);
return ans;
}
ll mn, mx;
MinMax(0, 1e18, &mn, &mx);
ll l = (mx - mn + n - 1) / n, r = mx - mn;
while (l <= r)
{
ll mid = (l + r) >> 1, cur = mn, x, y;
bool ok = false;
while (cur + mid <= mx)
{
MinMax(cur + 1, cur + mid - 1, &x, &y);
if (x == -1)
{
mn = cur;
ok = true;
break;
}
cur = y;
}
if (ok)
l = mid + 1;
else
r = mid - 1;
}
return --l;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
2392 KB |
Output is correct |
3 |
Correct |
1 ms |
2392 KB |
Output is correct |
4 |
Correct |
1 ms |
2388 KB |
Output is correct |
5 |
Correct |
1 ms |
2392 KB |
Output is correct |
6 |
Correct |
1 ms |
2392 KB |
Output is correct |
7 |
Correct |
1 ms |
2392 KB |
Output is correct |
8 |
Correct |
1 ms |
2392 KB |
Output is correct |
9 |
Correct |
2 ms |
2392 KB |
Output is correct |
10 |
Correct |
1 ms |
2392 KB |
Output is correct |
11 |
Correct |
1 ms |
2388 KB |
Output is correct |
12 |
Correct |
1 ms |
2392 KB |
Output is correct |
13 |
Correct |
1 ms |
2392 KB |
Output is correct |
14 |
Correct |
1 ms |
2392 KB |
Output is correct |
15 |
Correct |
1 ms |
2392 KB |
Output is correct |
16 |
Correct |
7 ms |
2696 KB |
Output is correct |
17 |
Correct |
9 ms |
2588 KB |
Output is correct |
18 |
Correct |
9 ms |
2588 KB |
Output is correct |
19 |
Correct |
9 ms |
2588 KB |
Output is correct |
20 |
Correct |
7 ms |
2576 KB |
Output is correct |
21 |
Correct |
30 ms |
3608 KB |
Output is correct |
22 |
Correct |
29 ms |
3624 KB |
Output is correct |
23 |
Correct |
29 ms |
3628 KB |
Output is correct |
24 |
Correct |
29 ms |
3620 KB |
Output is correct |
25 |
Correct |
28 ms |
3556 KB |
Output is correct |
26 |
Correct |
36 ms |
3628 KB |
Output is correct |
27 |
Correct |
32 ms |
3632 KB |
Output is correct |
28 |
Correct |
29 ms |
3872 KB |
Output is correct |
29 |
Correct |
32 ms |
3848 KB |
Output is correct |
30 |
Correct |
25 ms |
3624 KB |
Output is correct |
31 |
Correct |
1 ms |
2388 KB |
Output is correct |
32 |
Correct |
1 ms |
2392 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
2392 KB |
Partially correct |
2 |
Partially correct |
1 ms |
2392 KB |
Partially correct |
3 |
Partially correct |
1 ms |
2392 KB |
Partially correct |
4 |
Partially correct |
1 ms |
2392 KB |
Partially correct |
5 |
Partially correct |
1 ms |
2392 KB |
Partially correct |
6 |
Partially correct |
1 ms |
2392 KB |
Partially correct |
7 |
Partially correct |
1 ms |
2392 KB |
Partially correct |
8 |
Partially correct |
1 ms |
2392 KB |
Partially correct |
9 |
Partially correct |
1 ms |
2392 KB |
Partially correct |
10 |
Partially correct |
1 ms |
2392 KB |
Partially correct |
11 |
Partially correct |
2 ms |
2392 KB |
Partially correct |
12 |
Partially correct |
1 ms |
2644 KB |
Partially correct |
13 |
Partially correct |
1 ms |
2392 KB |
Partially correct |
14 |
Partially correct |
1 ms |
2392 KB |
Partially correct |
15 |
Partially correct |
5 ms |
2392 KB |
Partially correct |
16 |
Partially correct |
8 ms |
2752 KB |
Partially correct |
17 |
Partially correct |
24 ms |
2584 KB |
Partially correct |
18 |
Partially correct |
13 ms |
2584 KB |
Partially correct |
19 |
Partially correct |
10 ms |
2592 KB |
Partially correct |
20 |
Partially correct |
3 ms |
2572 KB |
Partially correct |
21 |
Partially correct |
43 ms |
3028 KB |
Partially correct |
22 |
Partially correct |
52 ms |
2856 KB |
Partially correct |
23 |
Partially correct |
35 ms |
2860 KB |
Partially correct |
24 |
Partially correct |
45 ms |
2868 KB |
Partially correct |
25 |
Partially correct |
537 ms |
2860 KB |
Partially correct |
26 |
Partially correct |
44 ms |
3144 KB |
Partially correct |
27 |
Partially correct |
35 ms |
2868 KB |
Partially correct |
28 |
Partially correct |
61 ms |
2860 KB |
Partially correct |
29 |
Partially correct |
74 ms |
2868 KB |
Partially correct |
30 |
Partially correct |
12 ms |
2860 KB |
Partially correct |
31 |
Partially correct |
0 ms |
2392 KB |
Partially correct |
32 |
Correct |
1 ms |
2392 KB |
Output is correct |