#include typedef long long ll; typedef unsigned long long ull; #define FOR(i,a,b) for(int (i)=(a);i<(b);i++) #define REP(i,n) FOR(i,0,n) #define RANGE(vec) (vec).begin(),(vec).end() using namespace std; class NoServiceEasy { public: ll square(int x) { return x*x; } ll dist2(const pair &a, const pair &b) { return square(a.first-b.first)+square(a.second-b.second); } void solve(void) { int N; cin>>N; // 中継局がないときは 1km が最大 if (N==0) { cout<<1<> xy; REP(i,N) { int x,y; cin>>x>>y; xy.emplace_back(x,y); } // 10km 以内にある中継局をつなぐことで作ったグループにたいして // そのグループ内での最長距離をもとめればよい vector> tree(N); REP(i,N) FOR(j,i+1,N) { if (dist2(xy[i],xy[j]) <= 10*10) { tree[i].push_back(j); tree[j].push_back(i); } } vector vis(N,false); vector d2(N,0); function dfs = [&](int x, int root) { if (vis[x]) return; vis[x] = true; d2[root] = max(d2[root], dist2(xy[x], xy[root])); for (auto y : tree[x]) { if (vis[y]) continue; dfs(y, root); } }; // 木ではなく森になっているかもしれないので根を変えて試す // O(N^2) REP(root,N) { fill(RANGE(vis),false); dfs(root,root); } ll maxD2 = *max_element(RANGE(d2)); cout<solve(); delete obj; return 0; } #endif