#include #include #include #define rep(i, l, n) for (int i = (l); i < (n); i++) using namespace std; using Pair = pair; template using V = vector; template using VV = V >; bool func(int N, VV&route, V&lis, int k) { V c(N); rep(v, 0, N) { if (c[v]) { continue; } c[v] = 1; V que = { v }; while (que.empty() == false) { int now = que[que.size() - 1]; que.pop_back(); for (auto& r : route[now]) { int nv = r.first, nd = r.second; if (nd <= lis[k]) { continue; } if (c[nv] == 0) { c[nv] = -c[now]; que.push_back(nv); } else if (c[nv] == c[now]) { return false; } } } } return true; } int main(void) { int N; cin >> N; VV P(N, V(2)); rep(i, 0, N) { cin >> P[i][0] >> P[i][1]; } set st = { 0 }; VV dist(N, V(N)); VV route(N, V(0)); rep(i, 0, N - 1) { rep(j, i + 1, N) { dist[i][j] = dist[j][i] = abs(P[i][0] - P[j][0]) + abs(P[i][1] - P[j][1]); route[i].push_back({ j,dist[i][j] }); route[j].push_back({ i,dist[i][j] }); st.insert(-dist[i][j]); } } V lis = {}; for (auto itr = st.begin(); itr != st.end(); itr++) { lis.push_back(-(*itr)); } int ok = 0, ng = lis.size(); while (ng - ok > 1) { int k = (ok + ng) / 2; if (func(N, route, lis, k)) { ok = k; } else { ng = k; } } int ans = lis[ok] / 2; cout << ans << endl; return 0; }