RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00401

Relay

Unrated 레이팅 미적용
난이도
1s
시간 제한
256MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

A fleet of fishing boats set sail on the open sea from an Adriatic island. The position of each fishing boat
is described with a point in the standard coordinate system, whereas the island is described with a convex
polygon. The boats communicate via radio devices, and the island represents an obstacle for the radio
waves. More precisely, if boat \(a\) transmits a message, then boat \(b\) receives the message if and only if the
line segment connecting the positions of \(a\) and \(b\) does not cross the interior of the island (it is allowed to
have the line segment touch the sides and vertices of the island).
1
2
3
4
5
6
7
8
9
Figure 3: In the first sample test, ships 2, 3, 4 and 7 will receive the original Mayday message, whereas
ships 6 and 8 will receive the Relay message.
When ship \(a\) gets in trouble, it transmits the \(so-ca\)lled Mayday message asking for help. All ships that
receive the Mayday message immediately send the \(so-ca\)lled Relay message repeating that ship \(a\) needs
help. If a ship only receives the Relay message (and not the original Mayday message), then it sends
nothing.
You are given the positions of \(n\) ships denoted with integers from 1 to \(n\) and the location of the island.
Ship number 1 has found itself in trouble and sends the Mayday message. Determine the total number of
ships that will receive either the original Mayday message or any of the Relay messages.

제약

Subtask
Score
Limitations
1
18
\(1 \le n \le 300\), \(3 \le m \le 300\)
2
19
\(1 \le n \le 3000\), \(3 \le m \le 3\,000\)
3
20
\(1 \le n \le 100\,000\), \(3 \le m \le 300\)
4
43
\(1 \le n \le 100\,000\), \(3 \le m \le 100\,000\)

입력 형식

The first line of input contains the integer \(n\) – the number of ships. The \(k^{th}\) of the following \(n\) lines
contains two integers \(xk\) and \(yk\) (−\(10^{9} \le xk\), y\(k \le 10^{9}\)) – the coordinates of the \(k^{th}\) ship. All ships are
located on different coordinates, not a single ship is located on a side or inside the polygon.
The following line contains the integer \(m\) – the number of vertices of the convex polygon describing the
island. The \(k^{th}\) of the following \(m\) lines contains two integers \(x^{′}\)
{k} ^{and} {y}
{(}{10} {≤}}^{′
{k}^{, y}^{′}
{≤}{9}} ^{–} ^{the
coordinates of the \(k^{th}\) vertex of the polygon. The polygon’s vertices are given in the count\(er-cl\)ockwise
direction and form a convex polygon. No two adjacent edges will be parallel.

출력 형식

You must output the required total number of boats that will receive one of the messages.
5 od 8

예제 1
입력
9
9 6
8 5
10 8
8 8
-2 3
-1 5
9 1
0 1
-1 2
7
1 1
5 1
8 3
7 5
4 6
0 5
-1 3
출력
6
예제 2
입력
4
-1 0
-3 -20
6 10
5 10
4
3 0
3 1
0 10
0 -10
출력
2
문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2015/2016 Olympiad

평가 및 의견

Relay

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Relay

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8