// In the name of the God
#include "gap.h"
#include <bits/stdc++.h>
#define ll long long
// #define int long long
#define pb push_back
#define F first
#define S second
#define mp make_pair
#define pii pair <int, int>
#define smin(x, y) (x) = min((x), (y))
#define smax(x, y) (x) = max((x), (y))
#define all(x) (x).begin(), (x).end()
using namespace std;
const int inf = 1e9+7;
const int mod = 998244353;
const ll maxn = 1e18;
ll a[100005];
ll findGap(int t, int n) {
if (t == 1) {
ll s = 1, e = maxn;
for (ll l = 1, r = n; l <= r; l++, r--) {
ll mn, mx;
MinMax(s, e, &mn, &mx);
a[l] = mn;
a[r] = mx;
s = mn + 1, e = mx - 1;
}
ll ans = 0;
for (ll i = 2; i <= n; i++) smax(ans, a[i] - a[i-1]);
return ans;
}
ll mn, mx;
MinMax(0, maxn, &mn, &mx);
ll g = (mn-mx+n-2)/(n-1);
ll ans = g, l = mn;
for (ll i = mn; i <= mx; i += g+1) {
MinMax(i, min(i+g, mx), &mn, &mx);
if (mn != -1) smax(ans, mn-l), l = mx;
}
return ans;
}
// int32_t main() {
// ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
// return 0;
// }
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
14 |
Correct |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
1 ms |
344 KB |
Output is correct |
16 |
Correct |
7 ms |
648 KB |
Output is correct |
17 |
Correct |
7 ms |
656 KB |
Output is correct |
18 |
Correct |
8 ms |
880 KB |
Output is correct |
19 |
Correct |
7 ms |
648 KB |
Output is correct |
20 |
Correct |
6 ms |
620 KB |
Output is correct |
21 |
Correct |
28 ms |
1976 KB |
Output is correct |
22 |
Correct |
29 ms |
1948 KB |
Output is correct |
23 |
Correct |
30 ms |
1892 KB |
Output is correct |
24 |
Correct |
32 ms |
1984 KB |
Output is correct |
25 |
Correct |
26 ms |
1960 KB |
Output is correct |
26 |
Correct |
28 ms |
1996 KB |
Output is correct |
27 |
Correct |
30 ms |
1976 KB |
Output is correct |
28 |
Correct |
29 ms |
1988 KB |
Output is correct |
29 |
Correct |
28 ms |
1980 KB |
Output is correct |
30 |
Correct |
26 ms |
1980 KB |
Output is correct |
31 |
Correct |
0 ms |
344 KB |
Output is correct |
32 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
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 |
1 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 |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
12 |
Runtime error |
1 ms |
344 KB |
Execution failed because the return code was nonzero |
13 |
Runtime error |
1 ms |
456 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 |
808 KB |
Execution failed because the return code was nonzero |
17 |
Runtime error |
4 ms |
652 KB |
Execution failed because the return code was nonzero |
18 |
Runtime error |
4 ms |
624 KB |
Execution failed because the return code was nonzero |
19 |
Runtime error |
4 ms |
648 KB |
Execution failed because the return code was nonzero |
20 |
Runtime error |
3 ms |
620 KB |
Execution failed because the return code was nonzero |
21 |
Runtime error |
13 ms |
1220 KB |
Execution failed because the return code was nonzero |
22 |
Runtime error |
13 ms |
1220 KB |
Execution failed because the return code was nonzero |
23 |
Runtime error |
13 ms |
1216 KB |
Execution failed because the return code was nonzero |
24 |
Runtime error |
16 ms |
1528 KB |
Execution failed because the return code was nonzero |
25 |
Runtime error |
11 ms |
1188 KB |
Execution failed because the return code was nonzero |
26 |
Runtime error |
14 ms |
1460 KB |
Execution failed because the return code was nonzero |
27 |
Runtime error |
14 ms |
1192 KB |
Execution failed because the return code was nonzero |
28 |
Runtime error |
14 ms |
1216 KB |
Execution failed because the return code was nonzero |
29 |
Runtime error |
14 ms |
1120 KB |
Execution failed because the return code was nonzero |
30 |
Runtime error |
9 ms |
1196 KB |
Execution failed because the return code was nonzero |
31 |
Runtime error |
1 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 |