#P14677. [ICPC 2025 Seoul R] Quadrants

[ICPC 2025 Seoul R] Quadrants

题目描述

This problem is about quadrants. What are quadrants? Let us begin with any two perpendicular lines \ell and \ell' in the plane R2\mathbb{R}^2. If you subtract the two lines \ell and \ell' from the whole plane R2\mathbb{R}^2, you obtain four connected, unbounded regions. Each of the four regions is called a quadrant. Note that the boundary of a quadrant does not belong to itself.

Now, consider a set PP of points in the plane R2\mathbb{R}^2. We are interested in quadrants defined by the set PP of points. Specifically, let Q\mathcal{Q} be the set of quadrants QQ such that the boundary of QQ contains exactly three points of PP. Each quadrant QQQ \in \mathcal{Q} is called a kk-quadrant if QQ contains exactly kk points of PP in its interior. The figure below shows an example in which the set PP consists of 14 points (small circles) and you can see a 5-quadrant QQQ \in \mathcal{Q} (shaded in cyan), whose boundary contains three points p,q,rPp, q, r \in P.

:::align{center} :::

Given a set PP of nn points as input, write a program that computes the number of kk-quadrants for every 0kn30 \le k \le n-3.

输入格式

Your program is to read from standard input. The input starts with a line containing a single integer nn (3n2,0003 \le n \le 2,000), where nn is the number of points in the input set PP. In each of the following nn lines, given are two integers xx and yy, both ranging from 106-10^6 to 10610^6, inclusively, that represent the xx- and yy-coordinates of an input point (x,y)(x,y) in PP. You may assume that no two input points have the same coordinates, that there are no three points in PP lying in a line, and that there are no two perpendicular lines \ell and \ell' in the plane R2\mathbb{R}^2 such that P2|\ell \cap P| \ge 2 and P2|\ell' \cap P| \ge 2.

输出格式

Your program is to write to standard output. Print exactly n2n-2 lines. The ii-th line of your output for each 1in21 \le i \le n-2 must contain a single integer that represents the number of (i1)(i-1)-quadrants with respect to the input set PP of nn points.

3
0 0
1 2
-1 4
2
4
0 0
1 2
-1 4
-1 1
0
4
10
47 20
4 30
3 21
44 12
46 34
18 18
19 50
48 23
22 3
19 22
2
12
20
18
20
30
28
1