using System; using System.Collections.Generic; using System.Linq; namespace Yukicoder { public class UF { private int[] _parent; private int[] _rank; public UF(int count) { _parent = new int[count]; _rank = new int[count]; for (int i = 0; i < _parent.Length; i++) { _parent[i] = i; } } private int Find(int value) { var parent = _parent[value]; if (parent == value) { return value; } _parent[value] = Find(parent); return _parent[value]; } public void Combine(int left, int right) { var leftParent = Find(left); var rightParent = Find(right); if (leftParent == rightParent) { return; } var leftRank = _rank[leftParent]; var rightRank = _rank[rightParent]; if (leftRank < rightRank) { _parent[leftParent] = rightParent; _rank[rightParent]++; return; } _parent[rightParent] = leftParent; _rank[leftParent]++; } public bool IsSameRoot(int left, int right) { return Find(left) == Find(right); } } class Program { static double GetDistance(int x1, int y1, int x2, int y2) { var dx = x1 - x2; var dy = y1 - y2; return Math.Abs(Math.Sqrt(dx*dx + dy*dy)); } static void Main(string[] args) { var n = int.Parse(Console.ReadLine()); int[] xPosition = new int[n]; int[] yPosition = new int[n]; for (int i = 0; i < n; i++) { var line = Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); xPosition[i] = line[0]; yPosition[i] = line[1]; } if (n == 0) { Console.WriteLine(1); return; } var unionFind = new UF(n); for (int i = 0; i < n; i++) { for (int j = 0; j < i; j++) { var distance = GetDistance(xPosition[i], yPosition[i], xPosition[j], yPosition[j]); if(distance < 10 + 1e-10) { unionFind.Combine(i, j); } } } var maxDistance = 0d; for (int i = 0; i < n; i++) { for (int j = 0; j < i; j++) { if (unionFind.IsSameRoot(i, j)) { var distance = GetDistance(xPosition[i], yPosition[i], xPosition[j], yPosition[j]); maxDistance = Math.Max(maxDistance, distance); } } } Console.WriteLine(maxDistance + 2); } } }