CodeForces - 1105D Kilani and the Game(bfs)

博客介绍了Kilani与朋友玩的一款基于网格的游戏,玩家按顺序扩张自己的领地。游戏结束时,Kilani想知道每位玩家控制的格子数。题目要求根据网格大小、玩家数量及扩张速度,计算每个玩家在游戏结束后的领地数量。这是一个多源BFS问题,难点在于处理不同扩张速度的玩家,并确保每次从相同速度的玩家中选择源点进行BFS。
摘要由CSDN通过智能技术生成

Kilani is playing a game with his friends. This game can be represented as a grid of size n×m, where each cell is either empty or blocked, and every player has one or more castles in some cells (there are no two castles in one cell).

The game is played in rounds. In each round players expand turn by turn: firstly, the first player expands, then the second player expands and so on. The expansion happens as follows: for each castle the player owns now, he tries to expand into the empty cells nearby. The player i can expand from a cell with his castle to the empty cell if it’s possible to reach it in at most si (where si is player’s expansion speed) moves to the left, up, right or down without going through blocked cells or cells occupied by some other player’s castle. The player examines the set of cells he can expand to and builds a castle in each of them at once. The turned is passed to the next player after that.

The game ends when no player can make a move. You are

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值