P1413 Wall-nut Bowling
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 $6$ rows and $60$ columns. A zombie, at the instant it appears, stands at column $60$ of its row, and then moves one step to the left every second. The player may place a wall-nut at column $1$ 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 $1$ and is not eliminated, and then moves further left, your brain will be eaten by the zombie.
Now there are $n$ 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 $n$, the number of zombies.
Each of the following $n$ lines contains two positive integers $P$ and $t$, 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.
Explanation/Hint
Constraints
For all testdata, $n \le 2000$, $t \le 100000$, $1 \le P \le 6$.
Source
Adapted from kkksc03.
Translated by ChatGPT 5