#P15350. [COCI 2025/2026 #4] 僵尸启示录 / Zombie Apocalypse
[COCI 2025/2026 #4] 僵尸启示录 / Zombie Apocalypse
Problem Description
There are zombies that are going to attack the city.
The zombies set off one by one from a zombie nest that is meters away from the city. Each zombie moves at a speed of meter per second, towards the city. The time interval between consecutive zombies leaving the nest is second. Let the time when the first zombie departs be the beginning of the -st second.
This means:
- At the end of the -st second, there is a zombie meter away from the nest.
- At the end of the -nd second, there are zombies meters away from the nest.
- At the end of the -rd second, there are zombies meters away from the nest.
- And so on.
When a zombie is meters away from the nest, it arrives at the city.
Now we place bombs on the road to defend the city. For each bomb, we know the following information:
- The bomb's position (i.e., its distance from the nest).
- The bomb's explosion radius.
- The time when the bomb is installed.
For a bomb with radius , suppose it is installed at position at time . This bomb will kill a zombie located at position if and only if holds at time . Zombies that have already arrived in the city will not be killed. A killed zombie cannot continue moving.
Bombs may be installed at any time and position; in particular, there may be multiple bombs at the same time (and/or) at the same position.
Find the number of zombies that arrive in the city.
Input Format
The first line contains three positive integers ().
The next lines each contain three integers (,,), describing a bomb, where:
- The bomb is installed meters away from the nest.
- The explosion radius is meters.
- The installation time is at the end of the -th second.
Output Format
Output one line with one integer: the number of zombies that arrive in the city.
6 3 3
3 1 2
5 0 7
4 4 8
1
7 7 1
3 2 6
2
3 3 1
3 3 3
0
Hint
Sample Explanation
The explanation for sample 1 is shown in the table below.
| Time (end of the -th second) | In the nest | On the road to the city | In the city |
|---|---|---|---|
| Initial state | |||
Subtasks
| Subtask ID | Score | Constraints |
|---|---|---|
| No additional constraints. |
Translated by ChatGPT 5