#include <bits/stdc++.h>
#include "gap.h"
#define ll long long
#define pb push_back
#define task "asd"
#define pll pair<ll, ll>
#define pii pair<pll, ll>
#define fi first
#define se second
using namespace std;
const ll mod = 1e9+7;
const ll N = 2e5+5;
const int base = 313;
ll findGap(int t, int n)
{
if(t == 1)
{
ll l = 0, r = 1e18, mn, mx, ans = 0;
MinMax(l, r, &mn, &mx);
l = mn, r = mx;
for(int i = 1; i < (n+1)/2; i ++)
{
MinMax(l+1, r-1, &mn, &mx);
ans = max(ans, max(mn-l, r-mx));
l = mn;
r = mx;
}
return max(ans, r-l);
}
else
{
ll l = 0, r = 1e18, mn, mx, ans = 0;
MinMax(l, r, &mn, &mx);
ll lst = mn;
ll len = (mx - mn) / (n - 1);
ans = len;
l = mn, r = mx;
for(ll i = l; i < r; i += len+1)
{
MinMax(i, i+len, &mn, &mx);
if(mn == -1)continue;
ans = max(ans, mn-lst);
lst = mx;
}
return ans;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
0 ms |
200 KB |
Output is correct |
5 |
Correct |
0 ms |
200 KB |
Output is correct |
6 |
Correct |
0 ms |
200 KB |
Output is correct |
7 |
Correct |
0 ms |
200 KB |
Output is correct |
8 |
Correct |
0 ms |
200 KB |
Output is correct |
9 |
Correct |
0 ms |
200 KB |
Output is correct |
10 |
Correct |
0 ms |
200 KB |
Output is correct |
11 |
Correct |
1 ms |
200 KB |
Output is correct |
12 |
Correct |
1 ms |
328 KB |
Output is correct |
13 |
Correct |
1 ms |
200 KB |
Output is correct |
14 |
Correct |
1 ms |
200 KB |
Output is correct |
15 |
Correct |
1 ms |
328 KB |
Output is correct |
16 |
Correct |
11 ms |
512 KB |
Output is correct |
17 |
Correct |
11 ms |
504 KB |
Output is correct |
18 |
Correct |
12 ms |
496 KB |
Output is correct |
19 |
Correct |
12 ms |
584 KB |
Output is correct |
20 |
Correct |
9 ms |
456 KB |
Output is correct |
21 |
Correct |
44 ms |
1044 KB |
Output is correct |
22 |
Correct |
50 ms |
1052 KB |
Output is correct |
23 |
Correct |
45 ms |
1076 KB |
Output is correct |
24 |
Correct |
47 ms |
1088 KB |
Output is correct |
25 |
Correct |
48 ms |
1032 KB |
Output is correct |
26 |
Correct |
44 ms |
1072 KB |
Output is correct |
27 |
Correct |
44 ms |
960 KB |
Output is correct |
28 |
Correct |
43 ms |
960 KB |
Output is correct |
29 |
Correct |
55 ms |
1052 KB |
Output is correct |
30 |
Correct |
35 ms |
968 KB |
Output is correct |
31 |
Correct |
0 ms |
200 KB |
Output is correct |
32 |
Correct |
0 ms |
200 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Correct |
1 ms |
200 KB |
Output is correct |
4 |
Correct |
0 ms |
200 KB |
Output is correct |
5 |
Correct |
0 ms |
200 KB |
Output is correct |
6 |
Correct |
0 ms |
200 KB |
Output is correct |
7 |
Correct |
0 ms |
200 KB |
Output is correct |
8 |
Correct |
1 ms |
200 KB |
Output is correct |
9 |
Correct |
1 ms |
200 KB |
Output is correct |
10 |
Correct |
0 ms |
200 KB |
Output is correct |
11 |
Correct |
1 ms |
200 KB |
Output is correct |
12 |
Correct |
1 ms |
200 KB |
Output is correct |
13 |
Correct |
1 ms |
328 KB |
Output is correct |
14 |
Correct |
1 ms |
328 KB |
Output is correct |
15 |
Correct |
1 ms |
328 KB |
Output is correct |
16 |
Correct |
15 ms |
420 KB |
Output is correct |
17 |
Correct |
15 ms |
496 KB |
Output is correct |
18 |
Correct |
15 ms |
456 KB |
Output is correct |
19 |
Correct |
18 ms |
508 KB |
Output is correct |
20 |
Correct |
9 ms |
456 KB |
Output is correct |
21 |
Correct |
63 ms |
1076 KB |
Output is correct |
22 |
Correct |
63 ms |
1048 KB |
Output is correct |
23 |
Correct |
62 ms |
1072 KB |
Output is correct |
24 |
Correct |
62 ms |
1184 KB |
Output is correct |
25 |
Correct |
56 ms |
984 KB |
Output is correct |
26 |
Correct |
62 ms |
1076 KB |
Output is correct |
27 |
Correct |
62 ms |
1036 KB |
Output is correct |
28 |
Correct |
62 ms |
1052 KB |
Output is correct |
29 |
Correct |
61 ms |
1056 KB |
Output is correct |
30 |
Correct |
37 ms |
968 KB |
Output is correct |
31 |
Correct |
1 ms |
200 KB |
Output is correct |
32 |
Correct |
0 ms |
200 KB |
Output is correct |