#include #include #include #include #include using namespace std; typedef pair PLL; vector points; vector< vector > length2; class UnionFind { private: vector parent; int trees; public: UnionFind() { } UnionFind(int n) { trees = n; parent.assign(n, 0); for (int i = 0; i < n; i++) { parent[i] = i; } } int find(int x) { if (parent[x] == x) { return x; } else { return parent[x] = find(parent[x]); } } bool same(int x, int y) { return find(x) == find(y); } void unite(int x, int y) { x = find(x); y = find(y); if (x != y) { parent[x] = y; trees--; } } int count() { return trees; } }; bool possible(long long len) { int n = points.size(); long long len2 = len * len; UnionFind uf(n); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (uf.same(i, j)) { continue; } if (len2 >= length2[i][j]) { uf.unite(i, j); } } } return uf.same(0, n - 1); } int main() { int n, x, y; cin >> n; points.assign(n, PLL()); for (int i = 0; i < n; i++) { cin >> x >> y; points[i] = make_pair(x, y); } length2.assign(n, vector(n, 0)); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { long long x = points[i].first - points[j].first; long long y = points[i].second - points[j].second; length2[i][j] = x * x + y * y; } } // 条件を満たさない最大長をさがす long long length = 0; for (int i = 31; i >= 0; i--) { long long tmp = length + (1LL << i); if (!possible(tmp)) { length = tmp; } } long long ans = length + 1; if (ans % 10 != 0) { ans = (ans / 10 + 1) * 10; } cout << ans << endl; return 0; }