#include using namespace std; using ll = long long; //重み付きUnion_Find(XOR) struct Weighted_dsu { public: Weighted_dsu() : _n(0) {} Weighted_dsu(int n) : _n(n), parent_or_size(n, -1),diff_weight(n,0) {} bool merge(int a, int b, int w) { int x = leader(a), y = leader(b); if(x==y){ if(diff(a,b)==w)return true; return false; } w ^= diff_weight[a], w ^= diff_weight[b]; if (-parent_or_size[x] < -parent_or_size[y]) std::swap(x, y); parent_or_size[x] += parent_or_size[y]; parent_or_size[y] = x; diff_weight[y] ^= w; return true; } int diff(int x, int y) { leader(x),leader(y); return diff_weight[y] ^ diff_weight[x]; } bool same(int a, int b) { return leader(a) == leader(b); } int leader(int a) { if (parent_or_size[a] < 0) return a; int r = leader(parent_or_size[a]); diff_weight[a] ^= diff_weight[parent_or_size[a]]; return parent_or_size[a] = r; } int size(int a) { return -parent_or_size[leader(a)]; } std::vector> groups() { std::vector leader_buf(_n), group_size(_n); for (int i = 0; i < _n; i++) { leader_buf[i] = leader(i); group_size[leader_buf[i]]++; } std::vector> result(_n); for (int i = 0; i < _n; i++) { result[i].reserve(group_size[i]); } for (int i = 0; i < _n; i++) { result[leader_buf[i]].push_back(i); } result.erase( std::remove_if(result.begin(), result.end(), [&](const std::vector& v) { return v.empty(); }), result.end()); return result; } private: int _n; std::vector parent_or_size; std::vector diff_weight; }; int main(){ int n; cin >> n; if(n >= 10000)return 1; vector> a(n); for(auto &&p:a)cin >> p.first >> p.second; auto dist = [&](int i, int j){ return abs(a[i].first - a[j].first) + abs(a[i].second - a[j].second); }; auto f = [&](ll lim){ Weighted_dsu uf(n); for(int i = 0; i < n; i++){ for(int j = 0; j < i; j++){ if(dist(i, j) > lim && !uf.merge(i, j, 1))return false; } } return true; }; ll ng = -1, ok = 1ll << 32, mid; while(ng + 1 < ok){ mid = (ng + ok) / 2; if(f(mid))ok = mid; else ng = mid; } cout << ok / 2 << '\n'; }