#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
#include "gap.h"
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end()
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))
template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }
ll findGap(int t, int n){
if(t == 1){
ll l = 0, r = 1e18;
ll mn = 0, mx = 0;
MinMax(l, r, &mn, &mx);
l = mn, r = mx;
int cnt = 0;
if(l != r) cnt = 2;
else cnt = 1;
ll ans = 0;
while(cnt < n){
MinMax(l + 1, r - 1, &mn, &mx);
if(mn == -1) break;
ans = max({mn - l, ans, r - mx});
l = mn, r = mx;
if(l == r) cnt++;
else cnt += 2;
}
ans = max(ans, r - l);
return ans;
}
else{
return 0;
}
}
/*
Things to look out for:
- Integer overflows
- Array bounds
- Special cases
Be careful!
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
256 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
4 ms |
384 KB |
Output is correct |
6 |
Correct |
4 ms |
384 KB |
Output is correct |
7 |
Correct |
4 ms |
384 KB |
Output is correct |
8 |
Correct |
4 ms |
384 KB |
Output is correct |
9 |
Correct |
4 ms |
384 KB |
Output is correct |
10 |
Correct |
4 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
6 ms |
432 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
18 ms |
512 KB |
Output is correct |
17 |
Correct |
16 ms |
512 KB |
Output is correct |
18 |
Correct |
16 ms |
512 KB |
Output is correct |
19 |
Correct |
16 ms |
512 KB |
Output is correct |
20 |
Correct |
13 ms |
512 KB |
Output is correct |
21 |
Correct |
51 ms |
1176 KB |
Output is correct |
22 |
Correct |
50 ms |
1144 KB |
Output is correct |
23 |
Correct |
58 ms |
1144 KB |
Output is correct |
24 |
Correct |
51 ms |
1172 KB |
Output is correct |
25 |
Correct |
43 ms |
1124 KB |
Output is correct |
26 |
Correct |
52 ms |
1144 KB |
Output is correct |
27 |
Correct |
50 ms |
1144 KB |
Output is correct |
28 |
Correct |
53 ms |
1144 KB |
Output is correct |
29 |
Correct |
60 ms |
1144 KB |
Output is correct |
30 |
Correct |
36 ms |
1092 KB |
Output is correct |
31 |
Correct |
4 ms |
384 KB |
Output is correct |
32 |
Correct |
4 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
2 |
Incorrect |
4 ms |
288 KB |
Output isn't correct |
3 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
4 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
5 |
Incorrect |
4 ms |
256 KB |
Output isn't correct |
6 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
7 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
8 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
9 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
10 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
11 |
Incorrect |
5 ms |
512 KB |
Output isn't correct |
12 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
13 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
14 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
15 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
16 |
Incorrect |
12 ms |
512 KB |
Output isn't correct |
17 |
Incorrect |
11 ms |
512 KB |
Output isn't correct |
18 |
Incorrect |
14 ms |
512 KB |
Output isn't correct |
19 |
Incorrect |
12 ms |
512 KB |
Output isn't correct |
20 |
Incorrect |
8 ms |
512 KB |
Output isn't correct |
21 |
Incorrect |
33 ms |
1144 KB |
Output isn't correct |
22 |
Incorrect |
32 ms |
1048 KB |
Output isn't correct |
23 |
Incorrect |
32 ms |
1144 KB |
Output isn't correct |
24 |
Incorrect |
41 ms |
1144 KB |
Output isn't correct |
25 |
Incorrect |
24 ms |
1076 KB |
Output isn't correct |
26 |
Incorrect |
31 ms |
1144 KB |
Output isn't correct |
27 |
Incorrect |
33 ms |
1148 KB |
Output isn't correct |
28 |
Incorrect |
38 ms |
1152 KB |
Output isn't correct |
29 |
Incorrect |
32 ms |
1164 KB |
Output isn't correct |
30 |
Incorrect |
18 ms |
1152 KB |
Output isn't correct |
31 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
32 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |