#include<bits/stdc++.h>
//#include "gap.h"
using namespace std;
using ll =long long;
ll Sub1(ll N) {
ll b[N + 2],ans, lo1, hi1, lo, hi, l, r;
l = 1;
r = N;
lo = 0;
hi = LONG_MAX;
while ( l <= r) {
MinMax(lo, hi, &lo1, &hi1);
if (lo1 == -1) break;
b[l] = lo1;
b[r] = hi1;
lo = lo1 + 1;
hi = hi1 - 1;
l ++;
r --;
}
ans = 0;
for (int i = 2; i <= N; i ++) {
ans =max(ans, b[i] - b[i - 1]);
}
return ans;
}
ll Sub2(ll N) {
ll l, r, x, y, ans;
MinMax(0, 1e18, l, r);
s = (r - l - 1)/(n - 1);
ans = s;
for ( i = l; i <= r; i += (s + 1)) {
MinMax(i, i + s, &x, &y);
if ( x != -1) {
ans =max(ans, x - l);
l = y;
}
}
return ans;
}
long long findGap(int T, int N) {
if ( T == 1) {
return Sub1(N);
}
else return Sub1(N);
}
Compilation message
gap.cpp: In function 'll Sub1(ll)':
gap.cpp:12:3: error: 'MinMax' was not declared in this scope
12 | MinMax(lo, hi, &lo1, &hi1);
| ^~~~~~
gap.cpp: In function 'll Sub2(ll)':
gap.cpp:29:2: error: 'MinMax' was not declared in this scope
29 | MinMax(0, 1e18, l, r);
| ^~~~~~
gap.cpp:30:2: error: 's' was not declared in this scope
30 | s = (r - l - 1)/(n - 1);
| ^
gap.cpp:30:19: error: 'n' was not declared in this scope
30 | s = (r - l - 1)/(n - 1);
| ^
gap.cpp:32:8: error: 'i' was not declared in this scope
32 | for ( i = l; i <= r; i += (s + 1)) {
| ^