#include "gap.h"
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
#define FOR(i, a, b) for (ll i = a; i < (b); i++)
#define F0R(i, a) for (ll i = 0; i < (a); i++)
#define FORd(i, a, b) for (ll i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (ll i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto &a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)
#define len(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fst first
#define nl endl
#define sec second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define ins insert
const int MOD = 1000000007;
const int MX = INT_MAX;
const int MN = INT_MIN;
vl arr;
void bin(ll left,ll right){
if(right>left)return;
ll val_l,val_r;
// cout << left << " " << right << " ";
MinMax(left,right,&val_l,&val_r);
// cout << val_l << " " << val_r << endl;
if(val_l==val_r){
if(val_l != -1)arr.pb(val_r);
return;
}
int mid = (val_l+val_r)>>1;
bin(val_l,mid);
bin(mid+1,val_r);
}
long long findGap(int T, int N)
{
arr.clear();
bin(0,1e18);
ll ans = 0;
// FOR(i,0,arr.size())cout << arr[i] << " ";
// cout << endl;
FOR(i,1,arr.size())ans = max(ans,arr[i]-arr[i-1]);
return ans;
}
Compilation message
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:19:39: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
19 | #define FOR(i, a, b) for (ll i = a; i < (b); i++)
| ^
gap.cpp:64:2: note: in expansion of macro 'FOR'
64 | FOR(i,1,arr.size())ans = max(ans,arr[i]-arr[i-1]);
| ^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
8 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
10 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
12 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
13 |
Incorrect |
1 ms |
208 KB |
Output isn't correct |
14 |
Incorrect |
1 ms |
208 KB |
Output isn't correct |
15 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
16 |
Incorrect |
3 ms |
464 KB |
Output isn't correct |
17 |
Incorrect |
4 ms |
540 KB |
Output isn't correct |
18 |
Incorrect |
3 ms |
464 KB |
Output isn't correct |
19 |
Incorrect |
4 ms |
480 KB |
Output isn't correct |
20 |
Incorrect |
3 ms |
464 KB |
Output isn't correct |
21 |
Incorrect |
15 ms |
1052 KB |
Output isn't correct |
22 |
Incorrect |
12 ms |
976 KB |
Output isn't correct |
23 |
Incorrect |
13 ms |
968 KB |
Output isn't correct |
24 |
Incorrect |
13 ms |
1084 KB |
Output isn't correct |
25 |
Incorrect |
9 ms |
1056 KB |
Output isn't correct |
26 |
Incorrect |
12 ms |
1064 KB |
Output isn't correct |
27 |
Incorrect |
12 ms |
1060 KB |
Output isn't correct |
28 |
Incorrect |
13 ms |
1064 KB |
Output isn't correct |
29 |
Incorrect |
18 ms |
976 KB |
Output isn't correct |
30 |
Incorrect |
8 ms |
976 KB |
Output isn't correct |
31 |
Incorrect |
1 ms |
208 KB |
Output isn't correct |
32 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
4 |
Incorrect |
1 ms |
208 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
8 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
9 |
Incorrect |
1 ms |
208 KB |
Output isn't correct |
10 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
208 KB |
Output isn't correct |
12 |
Incorrect |
0 ms |
336 KB |
Output isn't correct |
13 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
14 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
15 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
16 |
Incorrect |
3 ms |
464 KB |
Output isn't correct |
17 |
Incorrect |
3 ms |
464 KB |
Output isn't correct |
18 |
Incorrect |
3 ms |
500 KB |
Output isn't correct |
19 |
Incorrect |
3 ms |
464 KB |
Output isn't correct |
20 |
Incorrect |
2 ms |
464 KB |
Output isn't correct |
21 |
Incorrect |
12 ms |
1048 KB |
Output isn't correct |
22 |
Incorrect |
12 ms |
1064 KB |
Output isn't correct |
23 |
Incorrect |
13 ms |
1000 KB |
Output isn't correct |
24 |
Incorrect |
13 ms |
1060 KB |
Output isn't correct |
25 |
Incorrect |
10 ms |
1064 KB |
Output isn't correct |
26 |
Incorrect |
13 ms |
1052 KB |
Output isn't correct |
27 |
Incorrect |
14 ms |
1056 KB |
Output isn't correct |
28 |
Incorrect |
13 ms |
1056 KB |
Output isn't correct |
29 |
Incorrect |
13 ms |
996 KB |
Output isn't correct |
30 |
Incorrect |
8 ms |
1160 KB |
Output isn't correct |
31 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
32 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |