#include "gap.h"
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using PP = pair<ll, P>;
const ll n_ = 2e5 + 10, inf = (ll)2e9 * (ll)1e9 + 7, mod = 998244353;
ll n, m, tc = 1, a, b, c, d, sum, x, y, z, base, ans, k;
ll findGap(int T, int N) {
vector<ll> res(N);
ll l = 0, r = 1e18, mn, mx;
ll lidx = 0, ridx = N - 1;
while (lidx <= ridx) {
if (lidx == ridx) {
MinMax(l + 1, (ll)1e18, &mn, &mx);
res[lidx] = mn;
break;
}
MinMax(l + 1, r - 1, &mn, &mx);
res[lidx++] = mn, res[ridx--] = mx;
l = res[lidx], r = res[ridx];
}
ll ret = 0;
for (int i = 1; i < N; i++)
ret = max(ret, res[i] - res[i - 1]);
return ret;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
3 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
4 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
5 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
6 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
7 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
8 |
Runtime error |
1 ms |
344 KB |
Execution failed because the return code was nonzero |
9 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
10 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
11 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
12 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
13 |
Runtime error |
1 ms |
344 KB |
Execution failed because the return code was nonzero |
14 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
15 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
16 |
Runtime error |
3 ms |
804 KB |
Execution failed because the return code was nonzero |
17 |
Runtime error |
3 ms |
620 KB |
Execution failed because the return code was nonzero |
18 |
Runtime error |
3 ms |
856 KB |
Execution failed because the return code was nonzero |
19 |
Runtime error |
3 ms |
856 KB |
Execution failed because the return code was nonzero |
20 |
Runtime error |
2 ms |
856 KB |
Execution failed because the return code was nonzero |
21 |
Runtime error |
12 ms |
1880 KB |
Execution failed because the return code was nonzero |
22 |
Runtime error |
13 ms |
1880 KB |
Execution failed because the return code was nonzero |
23 |
Runtime error |
12 ms |
1888 KB |
Execution failed because the return code was nonzero |
24 |
Runtime error |
12 ms |
1880 KB |
Execution failed because the return code was nonzero |
25 |
Runtime error |
10 ms |
1868 KB |
Execution failed because the return code was nonzero |
26 |
Runtime error |
13 ms |
1880 KB |
Execution failed because the return code was nonzero |
27 |
Runtime error |
13 ms |
1880 KB |
Execution failed because the return code was nonzero |
28 |
Runtime error |
13 ms |
1812 KB |
Execution failed because the return code was nonzero |
29 |
Runtime error |
12 ms |
1880 KB |
Execution failed because the return code was nonzero |
30 |
Runtime error |
8 ms |
1880 KB |
Execution failed because the return code was nonzero |
31 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
32 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
3 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
4 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
5 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
6 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
7 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
8 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
9 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
10 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
11 |
Runtime error |
1 ms |
344 KB |
Execution failed because the return code was nonzero |
12 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
13 |
Runtime error |
1 ms |
344 KB |
Execution failed because the return code was nonzero |
14 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
15 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
16 |
Runtime error |
4 ms |
856 KB |
Execution failed because the return code was nonzero |
17 |
Runtime error |
4 ms |
828 KB |
Execution failed because the return code was nonzero |
18 |
Runtime error |
5 ms |
692 KB |
Execution failed because the return code was nonzero |
19 |
Runtime error |
3 ms |
856 KB |
Execution failed because the return code was nonzero |
20 |
Runtime error |
2 ms |
856 KB |
Execution failed because the return code was nonzero |
21 |
Runtime error |
21 ms |
1880 KB |
Execution failed because the return code was nonzero |
22 |
Runtime error |
12 ms |
1880 KB |
Execution failed because the return code was nonzero |
23 |
Runtime error |
12 ms |
1960 KB |
Execution failed because the return code was nonzero |
24 |
Runtime error |
22 ms |
1908 KB |
Execution failed because the return code was nonzero |
25 |
Runtime error |
10 ms |
1880 KB |
Execution failed because the return code was nonzero |
26 |
Runtime error |
12 ms |
1968 KB |
Execution failed because the return code was nonzero |
27 |
Runtime error |
12 ms |
1880 KB |
Execution failed because the return code was nonzero |
28 |
Runtime error |
12 ms |
1872 KB |
Execution failed because the return code was nonzero |
29 |
Runtime error |
13 ms |
1856 KB |
Execution failed because the return code was nonzero |
30 |
Runtime error |
7 ms |
1880 KB |
Execution failed because the return code was nonzero |
31 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
32 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |