HBC244826巅峰对决,数据结构,线段树2D-Lake题解

2拍不死你 算法基础篇 46 0
不断提升技能,才能在职场中立于不败之地!全网最全C++题库,助您成为编程领域的佼佼者。
Simply put, we can think of the game's map as a flat grid of infinite length and width, and there are only two kinds of things that can be placed on the grid: ``stone`` and ``water``. We refer to ``a 1x1 grid`` in the grid as ``one grid``.Each grid can be built by placing a stone block that can be placed anywhere . Once the stone is placed, it is fixed and does not change position.Water is special, similar to real-world water, Terraria's water will naturally flow downward, left and right when placed, and if it encounters a stone, it will stop flowing in that direction. For example, in the following figure, the same three stones, the left side of the placement can use a fixed block of water, and the right stone can not retain any water, the water will flow down to the right.Vega decided to build an aerial lake containing at least. m of water for fishing. He currently has a total of. n stones, please output as much water as he can fix, otherwise, output at least how many stones can fix at least

Terraria is a 2D action-adventure, open-world sandbox game. Simply put, we can think of the game's map as a flat grid of infinite length and width, and there are only two kinds of things that can be placed on the grid: ``stone`` and ``water``. We refer to ``a 1x1 grid`` in the grid as ``one grid``. Each grid can be built by placing a stone block that can be placed anywhere (allowing for hanging in the air, i.e. not requiring a block under each block). Once the stone is placed, it is fixed and does not change position. Water is special, similar to real-world water, Terraria's water will naturally flow downward, left and right when placed, and if it encounters a stone, it will stop flowing in that direction. For example, in the following figure, the same three stones, the left side of the placement can use a fixed block of water, and the right stone can not retain any water, the water will flow down to the right. Vega decided to build an aerial lake containing at least m m of water for fishing. He currently has a total of n n of stones to use. If he can fix at least m m of water with these n n stones, please output as much water as he can fix, otherwise, output at least how many stones can fix at least m m water .

HBC244826巅峰对决,数据结构,线段树2D-Lake题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
全网最全C++题库,助您挑战自我,突破极限,成为编程领域的佼佼者!

标签: HBC244826巅峰对决 数据结构 线段树2D-Lake题解