using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ProgrammingContest { class MainClass { Scanner sc; static void Main(string[] args) { new MainClass().Solve(); } struct Point { public double x, y; } const bool DEBUG = false; // TODO: must check!! void Solve() { if (DEBUG) { string backPath = ".."; char dirSep = System.IO.Path.DirectorySeparatorChar; string inFilePath = backPath + dirSep + backPath + dirSep + "in.txt"; sc = new Scanner(new System.IO.StreamReader(inFilePath)); } else { sc = new Scanner(); } int n = sc.NextInt; Point[] p = new Point[n]; for (int i = 0; i < n; i++) { p[i] = new Point(); p[i].x = sc.NextDouble; p[i].y = sc.NextDouble; } UnionFind uf = new UnionFind(n); for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { if (calcDist(p[i], p[j]) <= 10) { uf.unite(i, j); } } } Dictionary dic = new Dictionary(); int cnt = 0; for (int i = 0; i < n; i++) { if (!dic.ContainsKey(uf.find(i))) { dic.Add(uf.find(i), cnt++); } } List[] conLists = new List[dic.Count].Select(el => new List()).ToArray(); for (int i = 0; i < n; i++) { conLists[dic[uf.find(i)]].Add(i); } double ma = 1; foreach(List list in conLists) { foreach(int idx1 in list) { foreach (int idx2 in list) { ma = Math.Max(ma, calcDist(p[idx1], p[idx2]) + 2); } } } Console.WriteLine(ma); } double calcDist(Point a, Point b) { double x = a.x - b.x; double y = a.y - b.y; return Math.Sqrt(x * x + y * y); } } class UnionFind { private int[] uni; int count_; public UnionFind(int n) { this.uni = new int[n].Select(el => -1).ToArray(); } public int Count() { return this.count_; } public int Count(int n) { return -this.uni[this.find(n)]; } public int find(int n) { return (this.uni[n] < 0 ? n : this.uni[n] = this.find(this.uni[n])); } public bool unite(int a, int b) { a = this.find(a); b = this.find(b); if (a == b) { return false; } if (this.uni[a] > this.uni[b]) { int t = a; a = b; b = t; } this.uni[a] += this.uni[b]; this.uni[b] = a; this.count_--; return true; } public bool same(int a, int b) { return this.find(a) == this.find(b); } } class Scanner { Queue buffer; char[] sep; System.IO.TextReader reader; public Scanner(System.IO.TextReader reader = null) { this.buffer = new Queue(); this.sep = new char[] { ' ' }; this.reader = (reader ?? Console.In); } private void CheckBuffer() { if (this.buffer.Count == 0) { String[] sreArray = this.reader.ReadLine().Split(this.sep); foreach (String elStr in sreArray) { this.buffer.Enqueue(elStr); } } } public String Next { get { this.CheckBuffer(); return this.buffer.Dequeue(); } } public int NextInt { get { return int.Parse(this.Next); } } public double NextDouble { get { return double.Parse(this.Next); } } public long NextLong { get { return long.Parse(this.Next); } } public bool IsEmpty { get { this.CheckBuffer(); return this.buffer.Count == 0; } } } }