#P1472. Domino
Domino
Description
Input
输入第一行一个整数N, 代表有N个骨牌. 以下N行每行两个数Pi Hi, 分别表示第I个骨牌的位置和高度.
Output
输出仅一行, 表示最少推倒骨牌的数目
Samples
6
1 1
2 2
3 1
5 1
6 1
8 3
2
Explanation
|
| |
| | | | | |
1 2 3 4 5 6 7 8
Pushing 1 causes 2 and 3 to fall, while pushing 8 causes 6 to fall and gently makes 5 tip over as well.