#P1413. 坚果保龄球
坚果保龄球
Description
In the game PVZ, there is a mode called Wall-nut Bowling. Zombies appear from the right side of the map and walk left, and the player needs to roll wall-nuts from the left side to crush them.
We can model the map as a board with rows and columns. A zombie, at the instant it appears, stands at column of its row, and then moves one step to the left every second. The player may place a wall-nut at column of any row at any time; the wall-nut instantly rolls through that row and crushes all zombies currently on that row. If a zombie reaches column and is not eliminated, and then moves further left, your brain will be eaten by the zombie.
Now there are zombies. You are given each zombie’s appearance time and row (multiple zombies may appear at the same position simultaneously). What is the minimum number of wall-nuts required to eliminate all zombies?
Input Format
The first line contains a positive integer , the number of zombies.
Each of the following lines contains two positive integers and , denoting the row index of the zombie and the time when the zombie appears.
Output Format
Output a single integer, the minimum number of wall-nuts required.
10
1 1
1 61
2 1
2 60
3 1
3 2
3 3
3 4
4 1
4 99999
6
Hint
Constraints
For all testdata, , , .
Source
Adapted from kkksc03.
Translated by ChatGPT 5
京公网安备 11011102002149号