LeetCode周赛#104 Q4 Cat and Mouse (图论+博弈论,记忆化搜索)

这篇博客介绍了LeetCode周赛#104中的913题——猫和老鼠的博弈问题。在给定的无向图中,老鼠和猫交替移动,目标分别是到达0号洞穴和捕捉老鼠。文章详细解析了博弈的规则、结束条件,并探讨了在双方最优策略下,如何通过记忆化搜索来求解游戏结果,包括游戏可能的平局、老鼠胜利或猫胜利的情况。
摘要由CSDN通过智能技术生成

题目来源:https://leetcode.com/contest/weekly-contest-104/problems/cat-and-mouse/

问题描述

913. Cat and Mouse

A game on an undirected graph is played by two players, Mouse and Cat, who alternate turns.

The graph is given as follows: graph[a] is a list of all nodes b such that ab is an edge of the graph.

Mouse starts at node 1 and goes first, Cat starts at node 2 and goes second, and there is a Hole at node 0.

During each player's turn, they must travel along one edge of the graph that meets where they are.  For example, if the Mouse is at node 1, it must travel to any node in graph[1]

评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值