아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Eightgon

시간 제한10초메모리 제한512 MB

요약
주어진 점들 중에서 마주 보는 변이 서로 평행하고 길이가 같으며 적어도 한 변이 x축에 평행한 여덟 점의 팔각형 고리를 세는 문제이다.
난이도

보통10점 중 7점

유형
기하, 해시맵
정답자
아직 제출이 없습니다

문제

After many years you and your coauthor H. Addaway have finally developed a Theory of Everything that explains everything: Why does time have a direction? How should quantum mechanics be interpreted? What caused the Big Bang? What is love?

An unfortunate fact about physics is that physical theories need to be experimentally tested. In particular, your theory rests on the discovery of so called Barely Audible Particle Clusters (BAPCs). For this purpose you have proposed the development of a Large Eightgon Collider. What remains is to find a suitable location to construct this scientific wonder.

For obvious reasons, the Large Eightgon Collider must consist of eight straight tunnels that together form an underground cycle. Each tunnel is allowed to have a different non-zero length. At each of the eight tunnel connections, a special detector must be built, that also slightly deflects the particles 4545 degrees to the left. Each of the eight detectors attracts many researchers, requiring a shaft to the surface to supply them with fresh food and oxygen.

In order to save costs, they will reuse abandoned mine shafts. Given a map of all abandoned mine shafts, your job is to find the number of possible locations to build this miracle. You only consider locations where at least one tunnel runs parallel to the xx-axis of the map.

Figure E.1 shows the second sample.

Figure E.1: Visualisation of Sample 2 showing one possible location for the Large Eightgon Collider.

입력

The input consists of:

  • A line with an integer nn (1≤n≤50001 \leq n \leq 5000), the number of abandoned mine shafts.
  • nn lines, each with two integers xx and yy (−108≤x,y≤108-10^8 \leq x, y\leq 10^8), the coordinates of the abandoned mine shafts.

출력

Output the number of possible locations to build the Large Eightgon Collider.

예제2

  1. 예제 1

    입력
    8
    0 1
    1 0
    0 2
    2 0
    3 1
    1 3
    3 2
    2 3
    
    예상 출력
    1
    
  2. 예제 2

    입력
    21
    0 1
    0 2
    0 3
    1 0
    1 1
    1 2
    1 3
    1 4
    2 0
    2 1
    2 2
    2 3
    2 4
    3 0
    3 1
    3 2
    3 3
    3 4
    4 1
    4 2
    4 3
    
    예상 출력
    15