text: Compute distances of all points and keep the distances sorted so that query can work in O ( logn ) using Binary Search .
code: let p = new Array ( n ) ; for ( let i = 0 ; i < n ; i ++ ) { p [ i ] = 0 ; } preprocess ( p , x , y , n ) ;