Unverified Commit 44f2b133 authored by yizr-cnyali's avatar yizr-cnyali Committed by GitHub
Browse files

Merge pull request #1 from 24OI/master

Update
parents 622bb8a7 c09c25a8
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -84,21 +84,21 @@

在一个有向无环图中,只有一个起点,上面有一个棋子,两个玩家轮流沿着有向边推动棋子,不能走的玩家判负。

定义 $mex$ 函数的值为不属于集合 $S$ 中的最小非负整数,即:
定义 $\operatorname{mex}$ 函数的值为不属于集合 $S$ 中的最小非负整数,即:

$$
mex(S)=min\{x\} \quad (x \notin S, x \in N)
\operatorname{mex}(S)=\min\{x\} \quad (x \notin S, x \in N)
$$

例如 $mex(\{0, 2, 4\})=1$ , $mex(\{1, 2\})=0$ 。
例如 $\operatorname{mex}(\{0, 2, 4\})=1$ , $\operatorname{mex}(\{1, 2\})=0$ 。

对于状态 $x$ 和它的所有 $k$ 个后继状态 $y_1, y_2, \ldots, y_k$ ,定义 $SG$ 函数:
对于状态 $x$ 和它的所有 $k$ 个后继状态 $y_1, y_2, \ldots, y_k$ ,定义 $\operatorname{SG}$ 函数:

$$
SG(x)=mex\{SG(y_1), SG(y_2), \ldots, G(y_k)\}
\operatorname{SG}(x)=\operatorname{mex}\{\operatorname{SG}(y_1), \operatorname{SG}(y_2), \ldots, \operatorname{SG}(y_k)\}
$$

而对于由 $n$ 个有向图游戏组成的组合游戏,设它们的起点分别为 $s_1, s_2, \ldots, s_n$ ,则有定理:**当且仅当 $SG(s_1) \oplus SG(s_2) \oplus \ldots \oplus SG(s_n) \neq 0$ 时,这个游戏是先手必胜的。**
而对于由 $n$ 个有向图游戏组成的组合游戏,设它们的起点分别为 $s_1, s_2, \ldots, s_n$ ,则有定理:**当且仅当 $\operatorname{SG}(s_1) \oplus \operatorname{SG}(s_2) \oplus \ldots \oplus \operatorname{SG}(s_n) \neq 0$ 时,这个游戏是先手必胜的。**

这一定理被称作 SG 定理。

@@ -108,7 +108,7 @@ $$

那么,由 $n$ 个堆组成的 Nim 游戏,就可以视为 $n$ 个有向图游戏了。

根据上面的推论,可以得出 $SG(x)=x$ 。再根据 SG 定理,就可以得出 Nim 和的结论了。
根据上面的推论,可以得出 $\operatorname{SG}(x)=x$ 。再根据 SG 定理,就可以得出 Nim 和的结论了。

## 参考文献

+1 −0
Original line number Diff line number Diff line
从状态图上起点和终点同时开始进行宽度/深度优先搜索,如果发现相遇了,那么可以认为是获得了可行解。

docs/search/dbfs.md

deleted100644 → 0
+0 −1
Original line number Diff line number Diff line
从状态图上起点和终点同时开始进行宽度优先搜索,如果发现相遇了,那么可以认为是获得了可行解。

docs/string/palindrome-tree.md

deleted100644 → 0
+0 −1
Original line number Diff line number Diff line
+1 −2
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ nav:
    - 搜索部分简介: search/index.md
    - DFS: search/dfs.md
    - BFS: search/bfs.md
    - 双向 BFS: search/dbfs.md
    - 双向搜索: search/bidirectional.md
    - 启发式搜索: search/heuristic.md
    - A*: search/astar.md
    - 迭代加深搜索: search/iterative.md
@@ -81,7 +81,6 @@ nav:
    - 前缀函数与 KMP 算法: string/prefix-function.md
    - 字典树 (Trie): string/trie.md
    - 回文自动机: string/pam.md
    - 回文树: string/palindrome-tree.md
    - 后缀数组 (SA): string/sa.md
    - AC 自动机: string/ac-automaton.md
    - 后缀自动机 (SAM): string/sam.md