using System; using System.Collections; using System.Collections.Generic; using System.Threading.Tasks; class TEST{ static void Main(){ Sol mySol =new Sol(); mySol.Solve(); } } class Sol{ public void Solve(){ long[,] Dist=new long[N,N]; Parallel.For(0,N,i=>{ Parallel.For(i+1,N,j=>{ long l=0; long r=(long)2e9; long c=(l+r)/2; while(r-l>1){ c=(l+r)/2; if(c*c>d2(P[i],P[j])){ r=c; }else{ l=c; } } while(c*c>d2(P[i],P[j]))c--; while(c*c SH=new SkewHeap(); for(int i=1;i0){ var p=SH.Top;SH.Pop(); if(used[p.Pos])continue; Max=Math.Max(Max,p.Cost); used[p.Pos]=true; if(p.Pos==N-1)break; for(int i=0;iint.Parse(e));} static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));} static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));} } class Pair2 : IComparable { public int Pos; public long Cost; public Pair2(int p, long c) { Pos = p; Cost = c; } public int CompareTo(Pair2 t) { //return this.Cost > t.Cost ? -1 : this.Cost < t.Cost ? 1 : 0; return this.Cost > t.Cost ? 1 : this.Cost < t.Cost ? -1 : 0; } } class SkewHeap where T:IComparable{ public int Count{ get{return cnt;} private set{cnt=value;} } public SkewHeap(){ root=null; this.Count=0; } public void Push(T v){ NodeSH p=new NodeSH(v); root=NodeSH.Meld(root,p); this.Count++; } public void Pop(){ if(root==null)return; root=NodeSH.Meld(root.L,root.R); this.Count--; } public T Top{ get{return root.Val;} } int cnt; NodeSH root; class NodeSH where S : IComparable { public NodeSH L, R; public S Val; public NodeSH(S v){ Val = v; L = null; R = null; } public static NodeSH Meld(NodeSH a, NodeSH b){ if(a == null)return b; if (b == null) return a; if (a.Val.CompareTo(b.Val) > 0) swap(ref a, ref b); a.R = Meld(a.R, b); swap(ref a.L, ref a.R); return a; } static void swap(ref U x, ref U y) { U t = x; x = y; y = t; } } }