#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){
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:63:2: note: in expansion of macro 'FOR'
63 | FOR(i,1,arr.size())ans = max(ans,arr[i]-arr[i-1]);
| ^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
300 KB |
Execution failed because the return code was nonzero |
2 |
Runtime error |
1 ms |
208 KB |
Execution failed because the return code was nonzero |
3 |
Runtime error |
0 ms |
208 KB |
Execution failed because the return code was nonzero |
4 |
Runtime error |
0 ms |
208 KB |
Execution failed because the return code was nonzero |
5 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
6 |
Runtime error |
0 ms |
208 KB |
Execution failed because the return code was nonzero |
7 |
Runtime error |
1 ms |
208 KB |
Execution failed because the return code was nonzero |
8 |
Runtime error |
0 ms |
208 KB |
Execution failed because the return code was nonzero |
9 |
Runtime error |
0 ms |
208 KB |
Execution failed because the return code was nonzero |
10 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
11 |
Runtime error |
1 ms |
336 KB |
Execution failed because the return code was nonzero |
12 |
Runtime error |
1 ms |
316 KB |
Execution failed because the return code was nonzero |
13 |
Runtime error |
1 ms |
208 KB |
Execution failed because the return code was nonzero |
14 |
Runtime error |
1 ms |
208 KB |
Execution failed because the return code was nonzero |
15 |
Runtime error |
1 ms |
336 KB |
Execution failed because the return code was nonzero |
16 |
Runtime error |
4 ms |
496 KB |
Execution failed because the return code was nonzero |
17 |
Runtime error |
6 ms |
448 KB |
Execution failed because the return code was nonzero |
18 |
Runtime error |
6 ms |
424 KB |
Execution failed because the return code was nonzero |
19 |
Runtime error |
4 ms |
464 KB |
Execution failed because the return code was nonzero |
20 |
Incorrect |
16 ms |
848 KB |
Output isn't correct |
21 |
Runtime error |
17 ms |
1076 KB |
Execution failed because the return code was nonzero |
22 |
Runtime error |
20 ms |
1008 KB |
Execution failed because the return code was nonzero |
23 |
Runtime error |
19 ms |
1052 KB |
Execution failed because the return code was nonzero |
24 |
Runtime error |
15 ms |
1064 KB |
Execution failed because the return code was nonzero |
25 |
Runtime error |
12 ms |
1040 KB |
Execution failed because the return code was nonzero |
26 |
Runtime error |
14 ms |
1044 KB |
Execution failed because the return code was nonzero |
27 |
Runtime error |
15 ms |
1044 KB |
Execution failed because the return code was nonzero |
28 |
Runtime error |
15 ms |
976 KB |
Execution failed because the return code was nonzero |
29 |
Runtime error |
15 ms |
1020 KB |
Execution failed because the return code was nonzero |
30 |
Incorrect |
80 ms |
2176 KB |
Output isn't correct |
31 |
Runtime error |
1 ms |
208 KB |
Execution failed because the return code was nonzero |
32 |
Runtime error |
1 ms |
208 KB |
Execution failed because the return code was nonzero |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
208 KB |
Execution failed because the return code was nonzero |
2 |
Runtime error |
0 ms |
208 KB |
Execution failed because the return code was nonzero |
3 |
Runtime error |
0 ms |
208 KB |
Execution failed because the return code was nonzero |
4 |
Runtime error |
1 ms |
208 KB |
Execution failed because the return code was nonzero |
5 |
Partially correct |
0 ms |
208 KB |
Partially correct |
6 |
Runtime error |
1 ms |
208 KB |
Execution failed because the return code was nonzero |
7 |
Runtime error |
1 ms |
208 KB |
Execution failed because the return code was nonzero |
8 |
Runtime error |
0 ms |
208 KB |
Execution failed because the return code was nonzero |
9 |
Runtime error |
1 ms |
208 KB |
Execution failed because the return code was nonzero |
10 |
Partially correct |
0 ms |
208 KB |
Partially correct |
11 |
Runtime error |
1 ms |
208 KB |
Execution failed because the return code was nonzero |
12 |
Runtime error |
1 ms |
208 KB |
Execution failed because the return code was nonzero |
13 |
Runtime error |
1 ms |
208 KB |
Execution failed because the return code was nonzero |
14 |
Runtime error |
0 ms |
208 KB |
Execution failed because the return code was nonzero |
15 |
Runtime error |
1 ms |
336 KB |
Execution failed because the return code was nonzero |
16 |
Runtime error |
4 ms |
464 KB |
Execution failed because the return code was nonzero |
17 |
Runtime error |
4 ms |
424 KB |
Execution failed because the return code was nonzero |
18 |
Runtime error |
4 ms |
416 KB |
Execution failed because the return code was nonzero |
19 |
Runtime error |
6 ms |
420 KB |
Execution failed because the return code was nonzero |
20 |
Partially correct |
16 ms |
852 KB |
Partially correct |
21 |
Runtime error |
15 ms |
1008 KB |
Execution failed because the return code was nonzero |
22 |
Runtime error |
15 ms |
1060 KB |
Execution failed because the return code was nonzero |
23 |
Runtime error |
15 ms |
1044 KB |
Execution failed because the return code was nonzero |
24 |
Runtime error |
15 ms |
1052 KB |
Execution failed because the return code was nonzero |
25 |
Runtime error |
17 ms |
1088 KB |
Execution failed because the return code was nonzero |
26 |
Runtime error |
16 ms |
1052 KB |
Execution failed because the return code was nonzero |
27 |
Runtime error |
14 ms |
1004 KB |
Execution failed because the return code was nonzero |
28 |
Runtime error |
20 ms |
968 KB |
Execution failed because the return code was nonzero |
29 |
Runtime error |
14 ms |
1064 KB |
Execution failed because the return code was nonzero |
30 |
Partially correct |
64 ms |
2252 KB |
Partially correct |
31 |
Runtime error |
0 ms |
208 KB |
Execution failed because the return code was nonzero |
32 |
Runtime error |
1 ms |
208 KB |
Execution failed because the return code was nonzero |