# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
956307 |
2024-04-01T14:33:03 Z |
Nelt |
Gap (APIO16_gap) |
C++17 |
|
35 ms |
3868 KB |
#include "gap.h"
#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
using namespace std;
ll solve(ll l, ll r)
{
if (l == -1)
return 0;
ll mid = (l + r) >> 1, x, y, x1, y1;
MinMax(l, mid, &x, &y);
MinMax(mid + 1, r, &x1, &y1);
return max({x != -1 ? solve(l, mid) : 0, x1 != -1 ? solve(mid + 1, r) : 0, x1 - y});
}
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;
}
return solve(0, 1e18);
}
# |
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 |
0 ms |
2392 KB |
Output is correct |
4 |
Correct |
1 ms |
2392 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 |
2396 KB |
Output is correct |
8 |
Correct |
1 ms |
2396 KB |
Output is correct |
9 |
Correct |
2 ms |
2560 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
11 |
Correct |
1 ms |
2392 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 |
8 ms |
2588 KB |
Output is correct |
17 |
Correct |
8 ms |
2592 KB |
Output is correct |
18 |
Correct |
8 ms |
2648 KB |
Output is correct |
19 |
Correct |
8 ms |
2584 KB |
Output is correct |
20 |
Correct |
6 ms |
2568 KB |
Output is correct |
21 |
Correct |
29 ms |
3620 KB |
Output is correct |
22 |
Correct |
29 ms |
3620 KB |
Output is correct |
23 |
Correct |
29 ms |
3620 KB |
Output is correct |
24 |
Correct |
30 ms |
3624 KB |
Output is correct |
25 |
Correct |
27 ms |
3868 KB |
Output is correct |
26 |
Correct |
35 ms |
3608 KB |
Output is correct |
27 |
Correct |
30 ms |
3520 KB |
Output is correct |
28 |
Correct |
32 ms |
3624 KB |
Output is correct |
29 |
Correct |
29 ms |
3624 KB |
Output is correct |
30 |
Correct |
27 ms |
3532 KB |
Output is correct |
31 |
Correct |
1 ms |
2392 KB |
Output is correct |
32 |
Correct |
1 ms |
2392 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
2392 KB |
Execution failed because the return code was nonzero |
2 |
Runtime error |
1 ms |
2392 KB |
Execution failed because the return code was nonzero |
3 |
Runtime error |
1 ms |
2392 KB |
Execution failed because the return code was nonzero |
4 |
Runtime error |
0 ms |
2392 KB |
Execution failed because the return code was nonzero |
5 |
Runtime error |
1 ms |
2392 KB |
Execution failed because the return code was nonzero |
6 |
Runtime error |
1 ms |
2392 KB |
Execution failed because the return code was nonzero |
7 |
Runtime error |
0 ms |
2392 KB |
Execution failed because the return code was nonzero |
8 |
Runtime error |
0 ms |
2392 KB |
Execution failed because the return code was nonzero |
9 |
Runtime error |
1 ms |
2392 KB |
Execution failed because the return code was nonzero |
10 |
Runtime error |
1 ms |
2392 KB |
Execution failed because the return code was nonzero |
11 |
Runtime error |
1 ms |
2392 KB |
Execution failed because the return code was nonzero |
12 |
Runtime error |
1 ms |
2392 KB |
Execution failed because the return code was nonzero |
13 |
Runtime error |
1 ms |
2392 KB |
Execution failed because the return code was nonzero |
14 |
Runtime error |
1 ms |
2392 KB |
Execution failed because the return code was nonzero |
15 |
Runtime error |
1 ms |
2392 KB |
Execution failed because the return code was nonzero |
16 |
Runtime error |
4 ms |
2568 KB |
Execution failed because the return code was nonzero |
17 |
Runtime error |
4 ms |
2588 KB |
Execution failed because the return code was nonzero |
18 |
Runtime error |
4 ms |
2588 KB |
Execution failed because the return code was nonzero |
19 |
Runtime error |
4 ms |
2584 KB |
Execution failed because the return code was nonzero |
20 |
Runtime error |
3 ms |
2572 KB |
Execution failed because the return code was nonzero |
21 |
Runtime error |
14 ms |
2848 KB |
Execution failed because the return code was nonzero |
22 |
Runtime error |
14 ms |
2864 KB |
Execution failed because the return code was nonzero |
23 |
Runtime error |
14 ms |
2836 KB |
Execution failed because the return code was nonzero |
24 |
Runtime error |
14 ms |
2860 KB |
Execution failed because the return code was nonzero |
25 |
Runtime error |
11 ms |
2848 KB |
Execution failed because the return code was nonzero |
26 |
Runtime error |
17 ms |
2860 KB |
Execution failed because the return code was nonzero |
27 |
Runtime error |
14 ms |
2864 KB |
Execution failed because the return code was nonzero |
28 |
Runtime error |
14 ms |
2856 KB |
Execution failed because the return code was nonzero |
29 |
Runtime error |
18 ms |
2988 KB |
Execution failed because the return code was nonzero |
30 |
Runtime error |
11 ms |
2784 KB |
Execution failed because the return code was nonzero |
31 |
Runtime error |
1 ms |
2392 KB |
Execution failed because the return code was nonzero |
32 |
Runtime error |
0 ms |
2392 KB |
Execution failed because the return code was nonzero |