@@ -13,15 +13,15 @@ typedef long long T;
1313typedef Point < T > P ;
1414const T INF = numeric_limits < T > ::max ();
1515
16- bool on_x (const P & a , const P & b ) { return a .x < b .x ; }
17- bool on_y (const P & a , const P & b ) { return a .y < b .y ; }
16+ bool on_x (P a , P b ) { return a .x < b .x ; }
17+ bool on_y (P a , P b ) { return a .y < b .y ; }
1818
1919struct Node {
2020 P pt ; // if this is a leaf, the single point in it
2121 T x0 = INF , x1 = - INF , y0 = INF , y1 = - INF ; // bounds
2222 Node * first = 0 , * second = 0 ;
2323
24- T distance (const P & p ) { // min squared distance to a point
24+ T distance (P p ) { // min squared distance to a point
2525 T x = (p .x < x0 ? x0 : p .x > x1 ? x1 : p .x );
2626 T y = (p .y < y0 ? y0 : p .y > y1 ? y1 : p .y );
2727 return (P (x ,y ) - p ).dist2 ();
@@ -48,7 +48,7 @@ struct KDTree {
4848 Node * root ;
4949 KDTree (const vector < P > & vp ) : root (new Node ({all (vp )})) {}
5050
51- pair < T , P > search (Node * node , const P & p ) {
51+ pair < T , P > search (Node * node , P p ) {
5252 if (!node -> first ) {
5353 // uncomment if we should not find the point itself:
5454 // if (p == node->pt) return {INF, P()};
@@ -68,7 +68,7 @@ struct KDTree {
6868
6969 // find nearest point to a point, and its squared distance
7070 // (requires an arbitrary operator< for Point)
71- pair < T , P > nearest (const P & p ) {
71+ pair < T , P > nearest (P p ) {
7272 return search (root , p );
7373 }
7474};
0 commit comments