#include "bits/stdc++.h"
#include "gap.h"
using namespace std;
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define ll long long
#define pb push_back
#define pii pair<int, int>
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
const int MOD = 1e9+7;
const int N = 1e5+5;
ll a[N];
ll findGap(int t, int n){
if(t == 1){
ll l = 0, r = 1e18, id = 0, mn, mx, ans = 0;
for(int i = 0; i < (n+1)/2; ++i){
MinMax(l, r, &mn, &mx);
a[id++] = mn, a[id++] = mx, l = mn+1, r = mx-1;
}
sort(a, a+n);
for(int i = 0; i < n-1; ++i)
umax(ans, a[i+1]-a[i]);
return ans;
}
ll s, t;
MinMax(0, LLONG_MAX, &s, &t); //n + 1
ll d = (t - s + n) / (n - 1), mx = 0, a = s;
while (s + 1 < t) {
ll x, y;
MinMax(s + 1, min(s + d, t - 1), &x, &y);
if (x != -1) {
mx = max(mx, x - a); a = y;
}
s += d;
}
return max(mx, t - a);
}
Compilation message
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:28:9: error: declaration of 'long long int t' shadows a parameter
28 | ll s, t;
| ^
gap.cpp:16:16: note: 'int t' previously declared here
16 | ll findGap(int t, int n){
| ~~~~^