#P16034. [CSPro 33] 十滴水
[CSPro 33] 十滴水
Background
Luogu’s testdata is for community exchange only and is not official testdata. Official judging link: https://www.cspro.org/.
Problem Description
Ten Drops of Water is a very classic mini game.
:::align{center}
:::
Player C is playing a one-dimensional version of the Ten Drops of Water game. We describe the basic rules of the game with an example.
The game is played on a grid. Cells are indexed by integers , increasing from left to right. Among the cells, cells contain drops of water, and the other cells contain no water. In our example, , and in index order, the numbers of drops in each cell are .
The player can perform several operations. In each operation, the player chooses a cell that contains water and increases the number of drops in that cell by . At any time, if the number of drops in a cell is greater than or equal to , the drops in this cell will burst to both sides. At this moment, the cell is cleared (its water becomes ). Then, for both the left and right directions, do the following at the same time: find the nearest cell in that direction that currently contains water; if such a cell exists, increase its number of drops by . If at some moment multiple cells have at least drops, the leftmost one bursts first.
In our example, if the player performs an operation on the third cell, its number of drops becomes , so the third cell bursts. It is cleared, and the nearest cell with water on its left (the second cell) and on its right (the fourth cell) each gains drop. Now the numbers of drops become .
At this time, both the second and fourth cells have at least drops. According to the rule, the second cell bursts first. After that, the numbers of drops become . Finally, the fourth cell bursts, and the numbers of drops become .
Player C has started a game and performed operations. After each operation, Player C will wait until all cells with at least drops have finished bursting before performing the next operation.
Player C wants to know how good he is, so he wants to know how many cells still contain water after each operation.
It is guaranteed that these operations are all valid, i.e., in each operation, the chosen cell contains water at that time.
Input Format
Read from standard input.
The first line contains three integers , representing the grid width, the number of cells that contain water, and the number of operations.
The next lines each contain two integers , meaning that cell contains drops of water.
The next lines each contain one integer , meaning that Player C performs an operation on cell .
Output Format
Write to standard output.
Output lines, each containing one integer: the number of cells that contain water after this operation.
5 5 2
1 2
2 4
3 4
4 4
5 2
3
1
2
1
Hint
Subtasks
For all testdata,
- ,,;
- ,;
- All input are pairwise distinct;
- For each input , it is guaranteed that cell contains water at the time of the corresponding operation.
| Subtask ID | Special Property | Score | ||
|---|---|---|---|---|
| 1 | Yes | 15 | ||
| 2 | ^ | |||
| 3 | ^ | ^ | No | 10 |
| 4 | ^ | 15 | ||
| 5 | ^ | |||
| 6 | ^ | Yes | ||
| 7 | ^ | No | ||
Special Property: At any moment in the game (including during the chain reaction of bursting), there is at most one cell whose number of drops is greater than or equal to .
Translated by ChatGPT 5