#include #include #include #include using namespace std; const double EPS = 1e-8; struct UnionFind { int n; vector par; vector size_; UnionFind(int n_) : n(n_), par((size_t)n_), size_((size_t)n_,1){ for(int i = 0; n > i; i++)par[i] = i; } int root(int x){ if(par[x] == x)return x; return par[x] = root(par[x]); } void unite(int a,int b){ int ra = root(a); int rb = root(b); if(ra==rb)return; if(size(ra) > size(rb)) swap(ra,rb); par[ra] = rb; size_[rb] += size_[ra]; } bool same(int a, int b){ return root(a) == root(b); } int size(int a){ return size_[root(a)]; } void debug(){ for(int i = 0; n > i; i++){ cout << size_[root(i)] << " "; } cout << endl; return; } }; struct d{ int x,y; long long dist; bool operator<(const d &a)const{ if(dist == a.dist){ if(x == a.x)return y < a.y; return x < a.x; } return dist < a.dist; } bool operator==(const d &a)const{ return dist==a.dist && x==a.x && y == a.y; } bool operator>(const d &a)const{ return !((*this)>n; vector> A(n); for(int i = 0; n > i; i++){ cin>>A[i].first>>A[i].second; } priority_queue,greater> B; for(int i = 0; n > i; i++){ for(int j = i+1; n > j; j++){ B.push({i,j,(A[i].first-A[j].first)*(A[i].first-A[j].first)+(A[i].second-A[j].second)*(A[i].second-A[j].second)}); } } UnionFind C(n); while(C.size(0) != n){ auto x = B.top();B.pop(); C.unite(x.x,x.y); if(C.root(0) == C.root(n-1)){ if((long long)floor(sqrt(x.dist)) * (long long)floor(sqrt(x.dist)) == x.dist){ cout << ((long long)floor(sqrt(x.dist))+9)/10*10 << endl; }else{ cout << (int)((sqrt(x.dist)+10-EPS)/10)*10 << endl; } break; } } }