Quadrants

시간 제한2초메모리 제한2048 MB

요약
일반 위치에 있는 n개의 점이 주어질 때, 경계에 P의 점이 정확히 세 개 있고 내부에 정확히 k개의 점이 있는, 두 수직선으로 정의되는 사분면의 개수를 모든 k에 대해 센다.
난이도

어려움10점 중 9점

유형
기하, 정렬, 조합론, 투 포인터
정답자
아직 제출이 없습니다

문제

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 Q∈QQ ∈ \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 1414 points (small circles) and you can see a 55-quadrant Q∈QQ ∈ \mathcal{Q} (shaded in cyan), whose boundary contains three points p,q,r∈Pp, q, r ∈ P.

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

입력

Your program is to read from standard input. The input starts with a line containing a single integer nn (3≤n≤2,0003 ≤ n ≤ 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 ∣ℓ∩P∣≥2| \ell ∩ P| ≥ 2 and ∣ℓ′∩P∣≥2|\ell ' ∩ P| ≥ 2.

출력

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

예제3

  1. 예제 1

    입력
    3
    0 0
    1 2
    -1 4
    
    예상 출력
    2
    
  2. 예제 2

    입력
    4
    0 0
    1 2
    -1 4
    -1 1
    
    예상 출력
    0
    4
    
  3. 예제 3

    입력
    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
    16