#P15631. [2019 KAIST RUN Spring] Voronoi Diagram Again

[2019 KAIST RUN Spring] Voronoi Diagram Again

Problem Description

:::align{center}

Voronoi Diagram of size 4. :::

In the 2-dimensional Cartesian coordinate system, we define the Voronoi Diagram\textbf{Voronoi Diagram} of a non-empty set of points SS, as a diagram that divides the plane by the criteria "which point in the set SS is closest in this location?". More precisely, the Voronoi diagram of a given non-empty point set {P1,P2,,Pn}\{P_1, P_2, \cdots, P_n\} is a collection of regions\textbf{regions}: A point KK is included in region ii if and only if d(Pi,K)d(Pj,K)d(P_i, K) \le d(P_j, K) holds for all 1jn1 \le j \le n. Despite of usual Voronoi Diagram, we use taxicab distance in this problem. d(X,Y)d(X, Y) denotes the Taxicab\textbf{Taxicab} distance between point XX and YY. Taxicab distance between two points is the sum of the absolute differences of their Cartesian coordinates.

For example, in the picture above, every location over the plane is colored by the closest point with such location. The points which belongs to a single region is colored by a light color indicating a region, and the points which belongs to more than one region forms lines and points colored black.

We want to find the number of unbounded regions in Voronoi Diagram. The region is unbounded, if for any real number RR, there exists point PP in region such that d(O,P)>Rd(O, P) > R where OO is origin.

Input Format

In the first line, the number of points consisting Voronoi diagram nn is given. (1n200 0001 \le n \le 200\ 000)

In the iith line of next nn lines, two integers indicating xx and yy co-ordinate of PiP_i are given. These are the points consisting the Voronoi diagram. All nn points are distinct. (x,y109|x|, |y| \le 10^9)

Output Format

Output consists of single line, which consists of one integer. This should be the number of unbounded regions of Voronoi Diagram

4
0 0
-4 0
3 4
4 -2
4
5
1 1
2 2
3 3
4 4
5 5
5
9
-4 -4
-4 0
-4 4
0 -4
0 0
0 4
4 -4
4 0
4 4
8