시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
서브태스크 참고 (추가 시간 없음) | 1024 MB | 0 | 0 | 0 | 0.000% |
The first international Geese conference just wrapped up, and even though it should have been a happy occasion, it was bittersweet. The organizers found a paper with detailed plans of a duck infiltration. Now, they are trying to identify the infiltrating group from among the attendees.
The document that they found contained a list of $\mathbf{M}$ triples of integers $(\mathbf{X_i}, \mathbf{Y_i}, \mathbf{C_i})$ meaning the ducks would meet exactly $\mathbf{C_i}$ seconds after the start of the conference at point $(\mathbf{X_i}, \mathbf{Y_i})$, which is $\mathbf{X_i}$ meters east and $\mathbf{Y_i}$ meters north of the center of the conference floor. Each goose may or may not have been at those specific points at those specific times, but every duck certainly was.
Both ducks and geese walk at a maximum speed of one meter per second, which means an attendee that is at point $(x, y)$ at time $t$ can reach any point of the form $(x + \Delta_{x}, y + \Delta_{y})$ by time $t + \Delta_{t}$ as long as ${\Delta_{x}}^2 + {\Delta_{y}}^2 \le {\Delta_{t}}^2$. Each attendee's position at time $0$ can be any point, independently of the other attendees.
After the discovery, the group held a questioning session to try to identify the ducks. During that session, attendees issued a series of statements, one at a time. The $j$-th of those, in the order they were issued, was made by attendee $\mathbf{A_j}$, claiming that both they and attendee $\mathbf{B_j}$ were at point $(\mathbf{U_j}, \mathbf{V_j})$ exactly $\mathbf{D_j}$ seconds after the start of the conference. Points in statements may or may not be points where duck meetings happened.
Statements from geese are always true, but ducks may lie. Moreover, ducks know which attendees are ducks and which are geese. To avoid getting caught easily, ducks only make statements that are consistent with all statements previously made by geese. Note that statements made by geese are consistent with all ducks being at all duck meetings.
It may not be possible to determine all the ducks with the information provided. However, knowing the minimum number of ducks will at least provide a lower bound on the level of duck activity. Note that there was at least one duck. Find this minimum number of ducks.
Formally, a hypothesis $H$ is a partition of all attendees into a set of ducks (named $H$-ducks) and geese (named $H$-geese). $H$ is consistent with a set of statements $S$ if there exists a path for each attendee moving at most one meter per second such that:
A hypothesis $H$ is feasible under a set of statements $S$ if:
Notice that the hypotheses $H$ such that $H$-ducks contains all attendees is always feasible.
Find the minimum size of $H$-ducks over all feasible hypotheses $H$.
The first line of the input gives the number of test cases, $\mathbf{T}$. $\mathbf{T}$ test cases follow. Each test case starts with a line containing three integers, $\mathbf{N}$, $\mathbf{M}$, and $\mathbf{S}$, representing the numbers of attendees, duck meetings, and statements, respectively. The next $\mathbf{M}$ lines each describe a different duck meeting with three integers $\mathbf{X_i}$, $\mathbf{Y_i}$, and $\mathbf{C_i}$, representing that there was a meeting at point $(\mathbf{X_i}, \mathbf{Y_i})$, held exactly $\mathbf{C_i}$ seconds after the start of the conference. Then, the last $\mathbf{S}$ lines of a test case each describe a statement. The $j$-th of these lines describes the $j$-th issued statement with five integers $\mathbf{A_j}$, $\mathbf{B_j}$, $\mathbf{U_j}$, $\mathbf{V_j}$, and $\mathbf{D_j}$, representing that attendee $\mathbf{A_j}$ stated that they and attendee $\mathbf{B_j}$ were both at point $(\mathbf{U_j}, \mathbf{V_j})$ exactly $\mathbf{D_j}$ seconds after the start of the conference.
For each test case, output one line containing Case #x: y
, where $x$ is the test case number (starting from 1) and $y$ is the minimum number of ducks that might have infiltrated the conference.
시간 제한: 20 초
시간 제한: 60 초
2 2 1 2 1 2 3 1 2 1 1 1 2 1 2 2 2 4 2 4 4 3 10 -4 -3 20 1 3 4 3 11 2 4 0 0 16 3 1 6 3 9 4 2 0 0 16
Case #1: 1 Case #2: 2
In Sample Case #1, attendee 1 being the only duck is a feasible hypothesis.
In Sample Case #2, attendees 2 and 4 being the only ducks is a feasible hypothesis. Note that there is at least one duck, so all attendees being geese is not feasible.
Contest > Google > Code Jam > Google Code Jam 2022 > World Finals B번