#include <bits/stdc++.h>
#include "gap.h"
using namespace std;
typedef long long ll;
const int MAXN = 1e5 + 2;
ll K = 10;
vector<ll> ans;
ll f(ll L, ll R){
return max(1LL, (R - L + K - 1) / K);
}
void solve(ll L, ll R){
if(L > R) return ;
K = sqrt(R - L + 1);
ll d = f(L, R);
for(ll i = L; i <= R; i += d){
ll val_l = i, val_r = min(R, i + d - 1);
assert(val_l <= val_r);
MinMax(val_l, val_r, &val_l, &val_r);
if(val_l != -1){
ans.push_back(val_l);
if(val_r != val_l){
ans.push_back(val_r);
solve(val_l + 1, val_r - 1);
}
}
}
}
ll findGap(int t, int n){
if(t == 1){
int L = 0, R = n - 1;
ll val_l = 1, val_r = 1e18;
while(L <= R){
MinMax(val_l, val_r, &val_l, &val_r);
ans.push_back(val_l);
if(val_r != val_l) ans.push_back(val_r);
++L; --R;
++val_l; --val_r;
}
} else {
solve(1, 1e18);
}
ll ret = 0;
sort(ans.begin(), ans.end());
for(int i = 0; i < (int)ans.size() - 1; ++i) ret = max(ret, ans[i + 1] - ans[i]);
return ret;
}
Compilation message
fireworks.cpp:2:10: fatal error: gap.h: No such file or directory
2 | #include "gap.h"
| ^~~~~~~
compilation terminated.