HBC232088Max Sum,数据结构,线段树If I Catch You题解

三分之二給你 算法基础篇 80 1
不断提升技能,才能在职场中立于不败之地!全网最全C++题库,助您成为编程领域的佼佼者。
square loop for n=6: Liola and Eastred are playing a chasing game on a square loop which consists of 4n44n-44n4 grids, the size of the square is n×nntimes nn×n. Both Liola and Eastred can only move clockwise. In the beginning, Liola is at the upper right corner, and Eastred is at the bottom left corner. The game is played in rounds, each round performs the following steps in order: Liola places a trap at his current position. Eastred can't move to the grids with traps, but Liola ignores these traps. Liola moves 222 or 333 grids. Eastred moves 1,2,3,1,2,3,1,2,3, or 444 grids. At any time , the game is over if it meets any one of the following conditions: If all the [1,4][1,4][1,4] grids that Eastred can move have traps, Eastred can't move, Liola wins. If Liola and Eastred are at the same grid, Eastred catches Liola, Eastred wins. Both Liola and Eastred will play optimally. Can Eastred win?If he can, you should find theminimumnumber of rounds Eastred takes to win. In addition, If Liola can't win, he will try to make the number of rounds as large as possible.

square loop for n=6: Liola and Eastred are playing a chasing game on a square loop which consists of 4n−44n-44n−4 grids, the size of the square is n×nntimes nn×n. Both Liola and Eastred can only move clockwise. In the beginning, Liola is at the upper right corner, and Eastred is at the bottom left corner. The game is played in rounds, each round performs the following steps in order: Liola places a trap at his current position. Eastred can't move to the grids with traps, but Liola ignores these traps. Liola moves 222 or 333 grids. Eastred moves 1,2,3,1,2,3,1,2,3, or 444 grids. At any time (even if a round is not over), the game is over if it meets any one of the following conditions: If all the [1,4][1,4][1,4] grids that Eastred can move have traps, Eastred can't move, Liola wins. If Liola and Eastred are at the same grid, Eastred catches Liola, Eastred wins. Both Liola and Eastred will play optimally. Can Eastred win? If he can, you should find the minimum number of rounds Eastred takes to win. In addition, If Liola can't win, he will try to make the number of rounds as large as possible.

HBC232088Max Sum,数据结构,线段树If I Catch You题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)

标签: HBC232088Max Sum 数据结构 线段树If I Catch You题解