#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; const int MAXN = 1024; ll X[MAXN], Y[MAXN]; const ll INF = 1ll<<63; ll square(ll x) {return x*x;} ll lsqrt(ll n) { ll low = 0, high = 1ll<<31; while (high - low > 1) { ll med = (high + low) / 2; if (med * med <= n) low = med; else high = med; } return low; } // unionFind const int UNION_MAX = 1024; class unionFind { int par[UNION_MAX]; int Rank[UNION_MAX]; public: void init(int nn) { for (int i = 0; i <= nn; i++) { par[i] = i; Rank[i] = 0; } } int find(int x) { if (x == par[x]) return x; return par[x] = find(par[x]); } void unite(int x, int y) { x = find(x); y = find(y); if (x == y) return; if (Rank[x] < Rank[y]) { par[x] = y; } else { par[y] = x; if (Rank[x] == Rank[y]) Rank[x]++; } } bool same(int x, int y) { return find(x) == find(y); } }; unionFind uf; int main(void) { int N; cin >> N; for (int i = 0; i < N; i++) { cin >> X[i] >> Y[i]; } priority_queue > > que; for (int i = 0; i < N; i++) { for (int j = i+1; j < N; j++) { ll dist = lsqrt(square(X[i]-X[j]) + square(Y[i]-Y[j])); if (dist*dist < square(X[i]-X[j]) + square(Y[i]-Y[j])) { dist++; } if (dist % 10 == 0) que.push(make_pair(-dist/10*10, make_pair(i, j))); else que.push(make_pair(-(dist/10+1)*10, make_pair(i, j))); } } uf.init(N); ll ret = 10; while (1) { if (uf.same(0, N-1)) break; auto now = que.top(); que.pop(); ret = -now.first; uf.unite(now.second.first, now.second.second); } cout << ret << endl; return 0; }