Logo
(追記) (追記ここまで)

23772번 - Flatland Olympics 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
4 초 (추가 시간 없음) 1024 MB147353143.662%

문제

It is the day after Olympia, and you---as the organizer---are happy that everything worked well in these troublesome times. Well, not everything$\dots$.

Since this morning e-mails have been filling up your inbox, containing complaints about obscured views during the most important race: the 100ドル$-meter dash. They demand their money back, or threaten exposing you on social media. To make things worse, spectators have not just complained once, but they have sent you a separate e-mail for every person that blocked their view at some point during the race! They even wrote multiple e-mails when two or more people blocked their view at the same time. And not only that, some visitors complained to the main sponsor Dy & Son who in turn has urged you to improve the situation.

Since you expect that a greater number of visitors will be allowed to spectate at the next Olympic games, you assume that there will be even more complaints if you do not address this issue. If the situation will be too bad, you may even lose your sponsor Dy & Son. Therefore, you decide to count the number of complaints beforehand. To do this, you model the running track as a straight line segment, and count the maximal number of complaints you could get based on the seating of the visitors. Depending on the number of complaints you expect, you will determine if you need to rework the seating or just reconfigure your spam blocker and try to find a new sponsor.

입력

The input consists of:

  • One line containing four integers $x_s,ドル $y_s,ドル $x_e$ and $y_e$ $(|x_s|, |y_s|, |x_e|, |y_e| \leq10^9),ドル where $s=(x_s, y_s)$ is the starting point of the running track and $e=(x_e, y_e)$ is the end point of the running track. Both $s$ and $e$ belong to the running track.
  • One line containing an integer $n$ $(1 \leq n \leq 10^5),ドル the number of visitors.
  • $n$ lines, each containing two integers $x$ and $y$ $(|x|,|y|\leq10^9),ドル where $(x,y)$ is the location of the seat of a visitor.

It is guaranteed that the track has a positive length, i.e. $s\neq e$. Further, you can assume that all visitors are seated at distinct locations and that no visitor is seated on the track.

출력

Output the total number of complaints that you would receive for the given seating.

제한

예제 입력 1

0 0 100 0
4
50 20
50 30
50 50
120 0

예제 출력 1

3

예제 입력 2

0 0 100 0
5
50 20
50 30
50 -20
50 -30
100 30

예제 출력 2

2

힌트

Figure 1: Illustration of Sample Input 2. The running track is drawn as a red line and the seats of the visitors are highlighted in blue. The second visitor will complain about the first visitor and the fourth visitor will complain about the third visitor.

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > NWERC 2021 F번

  • 문제를 만든 사람: Harry Smit, Michael Zündorf
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /