//khodaya khodet komak kon
# include <bits/stdc++.h>
# include "gap.h"
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <pii, int> ppi;
typedef pair <int, pii> pip;
typedef pair <pii, pii> ppp;
typedef pair <ll, ll> pll;
# define A first
# define B second
# define endl '\n'
# define sep ' '
# define all(x) x.begin(), x.end()
# define kill(x) return cout << x << endl, 0
# define SZ(x) int(x.size())
# define lc id << 1
# define rc id << 1 | 1
# define fast_io ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
ll power(ll a, ll b, ll md) {return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md));}
const int xn = 1e6 + 10;
const int xm = - 20 + 10;
const int sq = 320;
const int inf = 1e9 + 10;
const ll INF = 1e18 + 10;
const ld eps = 1e-15;
const int mod = 1e9 + 7;//998244353;
const int base = 257;
ll findGap(int T, int n){
ll L, R, ans = 0, mn, mx;
MinMax(0, INF, &L, &R);
vector <ll> vec;
vec.push_back(L);
vec.push_back(R);
if (T == 1){
int l = 2, r = n - 1;
mn = L, mx = R;
while (l <= r){
MinMax(mn + 1, mx - 1, &mn, &mx);
vec.push_back(mn);
vec.push_back(mx);
++ l, -- r;
}
}
else{
ll t = (R - L + n - 2) / (n - 1);
ans = t;
ll last = L;
while (last < R){
MinMax(last + 1, last + t, &mn, &mx);
vec.push_back(mn);
vec.push_back(mx);
last += t;
}
}
sort(all(vec));
for (int i = 1; i < SZ(vec); ++ i)
ans = max(ans, vec[i] - vec[i - 1]);
return ans;
}
/*
int main(){
fast_io;
return 0;
}
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
208 KB |
Output is correct |
6 |
Correct |
0 ms |
208 KB |
Output is correct |
7 |
Correct |
1 ms |
208 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
0 ms |
208 KB |
Output is correct |
10 |
Correct |
0 ms |
208 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
1 ms |
464 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
336 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
13 ms |
848 KB |
Output is correct |
17 |
Correct |
12 ms |
840 KB |
Output is correct |
18 |
Correct |
13 ms |
860 KB |
Output is correct |
19 |
Correct |
11 ms |
892 KB |
Output is correct |
20 |
Correct |
8 ms |
848 KB |
Output is correct |
21 |
Correct |
45 ms |
2172 KB |
Output is correct |
22 |
Correct |
44 ms |
2204 KB |
Output is correct |
23 |
Correct |
43 ms |
2244 KB |
Output is correct |
24 |
Correct |
42 ms |
2368 KB |
Output is correct |
25 |
Correct |
38 ms |
2200 KB |
Output is correct |
26 |
Correct |
39 ms |
2240 KB |
Output is correct |
27 |
Correct |
42 ms |
2204 KB |
Output is correct |
28 |
Correct |
47 ms |
2200 KB |
Output is correct |
29 |
Correct |
41 ms |
2204 KB |
Output is correct |
30 |
Correct |
36 ms |
2240 KB |
Output is correct |
31 |
Correct |
0 ms |
208 KB |
Output is correct |
32 |
Correct |
0 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
208 KB |
Output is correct |
6 |
Correct |
0 ms |
208 KB |
Output is correct |
7 |
Correct |
0 ms |
208 KB |
Output is correct |
8 |
Correct |
1 ms |
208 KB |
Output is correct |
9 |
Correct |
0 ms |
208 KB |
Output is correct |
10 |
Correct |
0 ms |
208 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
2 ms |
336 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
336 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
15 ms |
1100 KB |
Output is correct |
17 |
Correct |
16 ms |
1212 KB |
Output is correct |
18 |
Correct |
15 ms |
1056 KB |
Output is correct |
19 |
Correct |
14 ms |
1180 KB |
Output is correct |
20 |
Correct |
8 ms |
1116 KB |
Output is correct |
21 |
Correct |
58 ms |
3264 KB |
Output is correct |
22 |
Correct |
58 ms |
3244 KB |
Output is correct |
23 |
Correct |
59 ms |
3192 KB |
Output is correct |
24 |
Correct |
58 ms |
3228 KB |
Output is correct |
25 |
Correct |
52 ms |
3268 KB |
Output is correct |
26 |
Correct |
62 ms |
3184 KB |
Output is correct |
27 |
Correct |
66 ms |
3220 KB |
Output is correct |
28 |
Correct |
60 ms |
3236 KB |
Output is correct |
29 |
Correct |
59 ms |
3228 KB |
Output is correct |
30 |
Correct |
33 ms |
3228 KB |
Output is correct |
31 |
Correct |
0 ms |
208 KB |
Output is correct |
32 |
Correct |
1 ms |
208 KB |
Output is correct |