#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define int ll
typedef pair<int32_t, int32_t> pi;
typedef vector <int> vi;
typedef vector <pi> vpi;
typedef pair<pi, ll> pii;
typedef set <ll> si;
typedef long double ld;
#define f first
#define s second
#define mp make_pair
#define FOR(i,s,e) for(int i=s;i<=int(e);++i)
#define DEC(i,s,e) for(int i=s;i>=int(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define maxn 200010
#define INF (ll)1e9
#define MOD 1000000007
typedef pair <vi, int> pvi;
typedef pair <int,pi> ipi;
typedef vector <pii> vpii;
long long findGap(int T, int N)
{
ll mx, ans = 1, x = 0, _;
MinMax(0,(ll)1e18,&x,&mx);
while (x != -1 && x <= mx){
ll amt = ans, res = -1, y;
while (res == -1 && x + amt <= mx){
MinMax(x+1,x+amt,&res,&y);
if (amt > (ll)1e18 / 2) break;
amt <<= 1;
}
ans = max(ans, res - x);
x = y;
}
return ans;
}
Compilation message
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:34:28: warning: unused variable '_' [-Wunused-variable]
34 | ll mx, ans = 1, x = 0, _;
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
Output isn't correct |
2 |
Execution timed out |
3091 ms |
208 KB |
Time limit exceeded |
3 |
Execution timed out |
3098 ms |
208 KB |
Time limit exceeded |
4 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
5 |
Execution timed out |
3090 ms |
208 KB |
Time limit exceeded |
6 |
Execution timed out |
3068 ms |
208 KB |
Time limit exceeded |
7 |
Execution timed out |
3057 ms |
208 KB |
Time limit exceeded |
8 |
Execution timed out |
3089 ms |
208 KB |
Time limit exceeded |
9 |
Execution timed out |
3099 ms |
208 KB |
Time limit exceeded |
10 |
Incorrect |
1 ms |
208 KB |
Output isn't correct |
11 |
Execution timed out |
3095 ms |
336 KB |
Time limit exceeded |
12 |
Execution timed out |
3084 ms |
208 KB |
Time limit exceeded |
13 |
Execution timed out |
3072 ms |
208 KB |
Time limit exceeded |
14 |
Execution timed out |
3097 ms |
208 KB |
Time limit exceeded |
15 |
Execution timed out |
3054 ms |
208 KB |
Time limit exceeded |
16 |
Execution timed out |
3074 ms |
464 KB |
Time limit exceeded |
17 |
Execution timed out |
3075 ms |
424 KB |
Time limit exceeded |
18 |
Execution timed out |
3079 ms |
464 KB |
Time limit exceeded |
19 |
Execution timed out |
3049 ms |
432 KB |
Time limit exceeded |
20 |
Incorrect |
6 ms |
464 KB |
Output isn't correct |
21 |
Execution timed out |
3013 ms |
1060 KB |
Time limit exceeded |
22 |
Execution timed out |
3025 ms |
984 KB |
Time limit exceeded |
23 |
Execution timed out |
3043 ms |
968 KB |
Time limit exceeded |
24 |
Execution timed out |
3025 ms |
976 KB |
Time limit exceeded |
25 |
Execution timed out |
3048 ms |
1004 KB |
Time limit exceeded |
26 |
Execution timed out |
3020 ms |
1096 KB |
Time limit exceeded |
27 |
Execution timed out |
3039 ms |
968 KB |
Time limit exceeded |
28 |
Execution timed out |
3041 ms |
1060 KB |
Time limit exceeded |
29 |
Execution timed out |
3039 ms |
1068 KB |
Time limit exceeded |
30 |
Incorrect |
30 ms |
1100 KB |
Output isn't correct |
31 |
Incorrect |
1 ms |
208 KB |
Output isn't correct |
32 |
Execution timed out |
3066 ms |
208 KB |
Time limit exceeded |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
2 |
Execution timed out |
3063 ms |
208 KB |
Time limit exceeded |
3 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
4 |
Execution timed out |
3085 ms |
208 KB |
Time limit exceeded |
5 |
Execution timed out |
3069 ms |
208 KB |
Time limit exceeded |
6 |
Execution timed out |
3055 ms |
208 KB |
Time limit exceeded |
7 |
Execution timed out |
3068 ms |
208 KB |
Time limit exceeded |
8 |
Execution timed out |
3072 ms |
208 KB |
Time limit exceeded |
9 |
Execution timed out |
3089 ms |
208 KB |
Time limit exceeded |
10 |
Incorrect |
1 ms |
208 KB |
Output isn't correct |
11 |
Execution timed out |
3075 ms |
208 KB |
Time limit exceeded |
12 |
Execution timed out |
3063 ms |
208 KB |
Time limit exceeded |
13 |
Execution timed out |
3050 ms |
208 KB |
Time limit exceeded |
14 |
Execution timed out |
3066 ms |
208 KB |
Time limit exceeded |
15 |
Execution timed out |
3049 ms |
208 KB |
Time limit exceeded |
16 |
Execution timed out |
3070 ms |
464 KB |
Time limit exceeded |
17 |
Execution timed out |
3053 ms |
512 KB |
Time limit exceeded |
18 |
Execution timed out |
3073 ms |
464 KB |
Time limit exceeded |
19 |
Execution timed out |
3042 ms |
464 KB |
Time limit exceeded |
20 |
Incorrect |
6 ms |
464 KB |
Output isn't correct |
21 |
Execution timed out |
3046 ms |
1056 KB |
Time limit exceeded |
22 |
Execution timed out |
3041 ms |
1008 KB |
Time limit exceeded |
23 |
Execution timed out |
3048 ms |
1064 KB |
Time limit exceeded |
24 |
Execution timed out |
3010 ms |
976 KB |
Time limit exceeded |
25 |
Execution timed out |
3059 ms |
1060 KB |
Time limit exceeded |
26 |
Execution timed out |
3072 ms |
1096 KB |
Time limit exceeded |
27 |
Execution timed out |
3061 ms |
968 KB |
Time limit exceeded |
28 |
Execution timed out |
3019 ms |
1136 KB |
Time limit exceeded |
29 |
Execution timed out |
3048 ms |
1020 KB |
Time limit exceeded |
30 |
Incorrect |
22 ms |
1084 KB |
Output isn't correct |
31 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
32 |
Execution timed out |
3092 ms |
208 KB |
Time limit exceeded |