#include #include #include using namespace std; long long hyp(long long a, long long b){ return a * a + b * b; } int uni[1001]; int getuni(int a){ if (uni[a] < 0) return a; else return uni[a] = getuni(uni[a]); } int connect(int a, int b){ a = getuni(a); b = getuni(b); if (a == b) return 0; if (uni[a] > uni[b]) swap(a, b); uni[a] += uni[b]; uni[b] = a; return 1; } int main() { int N; int x[1000], y[1000]; long long dist[1000][1000]; cin >> N; for (int i = 0; i < N; i++) { cin >> x[i] >> y[i]; } vector > > v; for (int i = 0; i < N - 1; i++) { for (int j = i + 1; j < N; j++) { long long temp = (long long)sqrt(hyp(x[i] - x[j], y[i] - y[j])); temp -= temp % 10; while (temp * temp < hyp(x[i] - x[j], y[i] - y[j])) temp += 10; dist[i][j] = temp; v.push_back(make_pair(temp, make_pair(i, j))); } } long long ans = 0; sort(v.begin(), v.end()); for (int i = 0; i < N; i++) { uni[i] = -1; } for (int i = 0; i < v.size(); i++) { if (connect(v[i].second.first, v[i].second.second)){ ans = v[i].first; } if (getuni(0) == getuni(N - 1)) break; } cout << ans << endl; cin >> ans; }