#include <bits/stdc++.h>
#include "gap.h"
using namespace std;
using ll = long long;
ll a[100201];
ll l[100201], r[100201];
pll b[100201];
const ll inf = 1'000'000'000'000'000'000;
ll findGap(ll T, ll n) {
ll mn, mx, ret = 0;
MinMax(0, inf, &mn, &mx);
a[1] = mn, a[n] = mx;
ll gap = (mx - mn) / n;
for (ll i = a[1], cnt = 1; cnt <= n; i += gap, cnt++) {
l[cnt] = i, r[cnt] = i + gap;
if (cnt == n) r[cnt] = a[n];
}
bool full = true;
for (int i = 1; i <= n; i++) {
MinMax(l[i], r[i], &mn, &mx);
b[i] = {mn, mx};
if (mn == -1) full = false;
ret = max(ret, mx - mn);
}
if (full) {
for (int i = 2; i <= n; i++) {
MinMax(b[i].first - b[i - 1].first, &mn, &mx);
ret = max(ret, mx - mn);
}
}
else {
ll bef = -1;
for (int i = 1; i <= n; i++) {
if (b[i].first == -1) continue;
MinMax(bef, b[i].first, &mn, &mx);
ret = max(ret, mx - mn);
bef = b[i].second;
}
}
return ret;
}
Compilation message
gap.cpp:9:1: error: 'pll' does not name a type; did you mean 'll'?
9 | pll b[100201];
| ^~~
| ll
gap.cpp: In function 'll findGap(ll, ll)':
gap.cpp:24:9: error: 'b' was not declared in this scope
24 | b[i] = {mn, mx};
| ^
gap.cpp:30:20: error: 'b' was not declared in this scope
30 | MinMax(b[i].first - b[i - 1].first, &mn, &mx);
| ^
gap.cpp:37:17: error: 'b' was not declared in this scope
37 | if (b[i].first == -1) continue;
| ^
gap.cpp:38:25: error: 'b' was not declared in this scope
38 | MinMax(bef, b[i].first, &mn, &mx);
| ^