시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
20 초 (추가 시간 없음) | 1024 MB | 19 | 14 | 14 | 73.684% |
2022 is a year of the Winter Olympics! Curling has been one of the most popular winter sports as it requires skill, strategy, and sometimes a bit of luck.
In a curling game, two teams compete by sliding heavy granite stones on a long ice sheet. We call the teams the red team and the yellow team, as their stones are usually distinguished by the red and the yellow handle color. A curling game consists of several ends (subgames); in every end, the teams, each owning $8$ stones, take turns to slide them across the long ice sheet toward a circular target area called the house. A stone may hit existing stones to change its own moving direction and other stones' position (including knocking them out of play). Roughly speaking, the goal for a team is to make their stones as close to the center of the house as possible.
Geometrically, a house and a stone can be modeled as a circle and a disk (the region bounded by a circle), respectively, and the scoring rules at the conclusion of each end are formally summarized as follows.
Two teams are playing and have just delivered all their stones. The red team has $\mathbf{N}$ stones remaining on the curling sheet, centered at $(\mathbf{X_1}, \mathbf{Y_1}), (\mathbf{X_2}, \mathbf{Y_2}), \dots, (\mathbf{X_N}, \mathbf{Y_N})$, while the yellow team has $\mathbf{M}$ stones remaining, centered at $(\mathbf{Z_1}, \mathbf{W_1}), (\mathbf{Z_2}, \mathbf{W_2}), \dots, (\mathbf{Z_M}, \mathbf{W_M})$. Now you are asked to figure out the scores of both teams.
The first line of the input gives the number of test cases, $\mathbf{T}$. $\mathbf{T}$ test cases follow.
Each test case begins with a line containing the two space-separated integers $\mathbf{R_s}$ and $\mathbf{R_h}$.
The next line contains the integer $\mathbf{N}$. Then $\mathbf{N}$ lines follow, the $i$-th line of which containing the two space-separated integers $\mathbf{X_i}$ and $\mathbf{Y_i}$.
After that, similarly, the next line contains the integer $\mathbf{M}$. In the next $\mathbf{M}$ lines, the $i$-th line contains the two space-separated integers $\mathbf{Z_i}$ and $\mathbf{W_i}$.
For each test case, output one line containing Case #x: y z
, where $x$ is the test case number (starting from 1), $y$ is the score of the red team, and $z$ is the score of the yellow team.
2 1 5 4 1 -1 6 1 0 6 -5 0 0 10 100 2 -3 -4 200 200 0
Case #1: 3 0 Case #2: 1 0
The following picture illustrates Sample Case #1. The big circle with a light blue interior represents the house, and the red disks represent the red team's stones.
In this case, the yellow team has no stones left in the house, so the red team receives a point for each of their stone in the house. All the existing stones are in the house except the one centered at $(6, 1)$ (it would have touched the house boundary if it were centered at $(6, 0)$), so the red team gets $3$ points.
2 1 5 2 1 0 -3 0 1 0 2 10 50 2 -40 -31 -35 70 3 59 0 -10 0 30 40
Case #1: 1 0 Case #2: 0 2
The following picture illustrates Sample Case #1. Besides the big circle and the red disks, the yellow disk represents the yellow team's only remaining stone.
In this case, both teams have stones inside the house. The red stone at $(1, 0)$ is in the house and no yellow stone is closer than it to the center of the house, so it is worthy of a point. Although the other red stone (centered at $(-3, 0)$) is also in the house, it is not worthy of a point because the yellow stone centered at $(0, 2)$ is closer than it to the center $(0,0)$. The yellow stone is not worthy of a point, either, due to the existence of the red stone at $(1, 0)$. Therefore, the red team gets $1$ point and the yellow team gets $0$ points.
Contest > Google > Kick Start > Google Kick Start 2022 > Round G B번