/* -*- coding: utf-8 -*- * * 2612.cc: No.2612 Close the Distance - yukicoder */ #include #include #include using namespace std; /* constant */ const int MAX_N = 200000; const int MAX_D = 2000000000; /* typedef */ using ll = long long; using vi = vector; /* global variables */ int xs[MAX_N], ys[MAX_N]; /* subroutines */ inline int md(int i, int j) { return abs(xs[j] - xs[i]) + abs(ys[j] - ys[i]); } int mostdist(vi &v, int st) { int maxd = -1, maxu = -1; for (auto u: v) { int d = md(st, u); if (maxd < d) maxd = d, maxu = u; } return maxu; } bool check(int n, int u0, int u1, int d) { vi v; for (int u = 0; u < n; u++) if (md(u0, u) > d && md(u1, u) > d) v.push_back(u); if (v.empty()) return true; int u2 = mostdist(v, v[0]); int u3 = mostdist(v, u2); return md(u2, u3) <= d; } /* main */ int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d%d", xs + i, ys + i); vi v0(n); for (int i = 0; i < n; i++) v0[i] = i; int u0 = mostdist(v0, 0); int u1 = mostdist(v0, u0); //printf(" u0=%d, u1=%d\n", u0, u1); int d0 = -1, d1 = MAX_D; while (d0 + 1 < d1) { int d = ((ll)d0 + d1) / 2; if (check(n, u0, u1, d)) d1 = d; else d0 = d; } printf("%d\n", d1); return 0; }