CF1619G Unusual Minesweeper
题目描述
Polycarp 非常喜欢玩扫雷游戏。最近,他发现了一个类似的游戏,也有这样的规则。
场地上有一些地雷,每个地雷的坐标 $(x_i,y_i)$ 都是已知的,每个坐标都有以秒为单位的倒计时,之后地雷就会爆炸。爆炸后,地雷会引爆所有与地雷垂直和水平距离在 $k$ 之内的地雷,结果就是我们得到了形状为"+"的爆炸。而一次爆炸可以引起新的爆炸,每次都是这样。
此外,从 $0$ 秒开始,Polycarp 可以每秒引爆任意一个地雷,连锁反应随之发生。需要注意的是,地雷会立刻爆炸并立刻引爆其它地雷。
Polycarp 想创造一个新纪录,请你帮他计算一下,他最快能在多少秒内引爆所有地雷?
输入格式
无
输出格式
无
说明/提示
Picture from examplesFirst example:
- $ 0 $ second: we explode a mine at the cell $ (2, 2) $ , it does not detonate any other mine since $ k=0 $ .
- $ 1 $ second: we explode the mine at the cell $ (0, 1) $ , and the mine at the cell $ (0, 0) $ explodes itself.
- $ 2 $ second: we explode the mine at the cell $ (1, 1) $ , and the mine at the cell $ (1, 0) $ explodes itself.
Second example:
- $ 0 $ second: we explode a mine at the cell $ (2, 2) $ we get:
- $ 1 $ second: the mine at coordinate $ (0, 0) $ explodes and since $ k=2 $ the explosion detonates mines at the cells $ (0, 1) $ and $ (1, 0) $ , and their explosions detonate the mine at the cell $ (1, 1) $ and there are no mines left on the field.