消失吧,群青
发现时刻和位置可以非整数很难处理,由于精度要求不高,我们把时间和长度尺度全部乘以
二分答案 set 维护这些区间,时间经过
#include <bits/stdc++.h>
#define LL long long
#define ull unsigned long long
#define uint unsigned int
using namespace std;
const int N = 2e5 + 10;
int n; pair<LL, LL> A[N];
struct Info { LL l, r, t; };
const bool operator<(const Info a, const Info b) {
return (a.l != b.l ? a.l < b.l : (a.r != b.r ? a.r < b.r : a.t < b.t));
}
set<Info> s;
void upd(Info x, LL t) {
auto it = s.find(x);
if (it == s.end()) return ;
auto [l, r, t0] = *it; r += t - t0; l -= t - t0; it = s.erase(it);
while (it != s.end() && it->l - r <= t - it->t)
r = max(r, it->r + t - it->t), it = s.erase(it);
while (it != s.begin()) {
it = prev(it); if (l - it->r > t - it->t) break;
l = min(l, it->l - t + it->t); it = s.erase(it);
}
s.insert({l, r, t});
}
void upd(LL x, LL t) {
auto it = s.lower_bound({x + 1, 0, 0}); upd(*it, t);
it = s.lower_bound({x + 1, 0, 0}); if (it != s.begin()) upd(*prev(it), t);
}
bool check(LL d) {
if (d == 0) return true;
s.clear(); s.insert({0, 0, 0});
for (int i = 1; i <= n; i ++) {
if (s.empty()) return false;
auto [cur, x] = A[i];
LL l = x - d + 1, r = x + d - 1;
upd(r, cur); upd(l, cur);
auto it = s.lower_bound({l + 1, 0, 0});
if (it != s.begin() && prev(it)->r >= l) {
auto [a, b, c] = *prev(it); s.erase(prev(it));
if (a < l) s.insert({a, l - 1, c});
if (b > r) { s.insert({r + 1, b, c}); continue; }
}
while (it != s.end() && it->l <= r) {
auto [a, b, c] = *it; it = s.erase(it);
if (b > r) { s.insert({r + 1, b, c}); break; }
}
}
return !s.empty();
}
int main() {
freopen(".in", "r", stdin); freopen(".out", "w", stdout);
ios::sync_with_stdio(false); cin.tie(0), cout.tie(0);
cin >> n; const ull K = 1000;
for (int i = 1, t, x; i <= n; i ++)
cin >> t >> x, A[i] = {1ll * t * K, 1ll * x * K};
sort(A + 1, A + 1 + n);
LL L = 0, R = 1e13;
while (L + 1 < R) {
LL mid = (L + R) >> 1;
if (check(mid)) L = mid;
else R = mid;
}
cout << fixed << setprecision(1) << (double)L / K << "\n";
return 0;
}