luogu#P10824. [EC Final 2020] Plants vs Zombies
[EC Final 2020] Plants vs Zombies
题目描述
Prof. Pang is playing .
Imagine that the game is played on a number axis. The following are the elements in the game:
- zombies. The -th zombie appears at on the number axis at time with health point . The zombies have the same moving speed and they all move to the right.
- spikeweeds. The -th spikeweed is of position and attack power .
- One peashooter at the position of . It shoots peas of attack power every second.
Every second in the game is processed as follows:
- When the -th second begins, the zombies whose s equal appear at position .
- After that, for each appeared and alive zombie , it will suffer from the spikeweeds whose positions are in where is the current position of the -th zombie. So its health point will be decreased by $\sum\limits_{1\le i\le m, P_u < p_i \le P_u + V} a_i$. The zombie dies if its health point is no more than zero. Otherwise, it is still alive and its position will be increased by .
- When the -th second ends, the peashooter shoots peas in a row. For each pea, it will hit the zombie that is alive and of the maximum position currently. If there are multiple zombies of the maximum position, the pea hits the one of the minimum index. The health point of the zombie being hit decreases by . This zombie dies if its health point is decreased to some value no more than . The peas are processed one by one, not simultaneously. (For example, if a zombie is killed by the first pea, the second pea cannot hit it since it dies before the second pea is shot.) If no alive zombie exists, the remain peas will hit nothing.
Prof. Pang wants to know the death time (in seconds) of all the zombies.
输入格式
The first line contains five integers () separated by single spaces.
Each of the following lines contains two integers () separated by a single space.
Each of the following lines contains two integers () separated by a single space.
输出格式
Output one line containing integers, where the -th integer denotes the death time (in seconds) of the -th zombie.
3 2 1 2 2
1 11
2 8
1 1
1 2
2 4
2 3 1
提示
During the first second:
- The first zombie appears and then moves to position 1. It suffers damage points ( from the first spikeweed, from the two peas).
- The third zombie appears and then moves to position 1. It suffers damage points (from the first spikeweed) and dies (since its health point becomes ).
During the second second:
- The first zombie moves to position and suffers damage points ( from the second spikeweed, from the first pea) and dies (since its health point becomes ).
- The second zombie appears and then moves to position . It suffers damage points ( from the first spikeweed, from the second pea).
During the third second:
- The second zombie moves to position , suffers damage points ( from the second spikeweed) and dies (since its health point becomes ).
- The peas hit no zombie during this second.
So the death times of the zombies are , , , respectively.