#include "bits/stdc++.h"
#include "gap.h"
using namespace std;
using ll = long long;
long long findGap(int t, int n) {
vector<ll> a(n);
int l = 0, r = n - 1;
ll lx = -1, rx = 1e18 + 1;
while (l <= r) {
ll mn, mx;
MinMax(lx, rx, &mn, &mx);
// cout << '\t' << lx << ' ' << rx << ' ' << mn << ' ' << mx << endl;
a[l++] = mn, a[r--] = mx;
lx = mn + 1, rx = mx - 1;
}
ll ans = 0;
for (int i = 1; i < n; i++) ans = max(ans, a[i] - a[i - 1]);
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |