跳到正文

休闲·娱乐

阴阳

Hamburger999约 13 分钟
原文
文章信息与版本

文章信息

发布
2026年1月27日
收录
2026年1月27日
更新
2026年9月10日
篇幅
约 13 分钟

版本

  1. v4当前
  2. v3
  3. v2
  4. v1

1. 规则介绍

阴阳是一个解谜游戏。网址:this。

规则:有一个 n×nn \times n 的棋盘,上面有一些固定的黑子和白子,其余的位置均为空。

你要将空位置填上黑子和白子,使得:

  1. 黑子和白子各自形成一个四连通块;
  2. 不存在 2×22 \times 2 的方阵区域使得这里的棋子颜色相同。

如下是一个谜题和解答:

2. 一些引理

2.1 引理 1

不存在 2×22 \times 2 的方阵区域,使得两条对角线上的棋子均相同。

情况 1:如红色区域,这不符合规则 22; 情况 2:如黑色区域,这会导致某种颜色不四连通(显然)。这不符合规则 11;

2.2 引理 2

边缘线上的某种颜色棋子(黑/白)的极长连续段不会 ≥2\ge 2 条。

如上图,白色棋子在边缘构成了 22 个极长连续段,若将它们连通则会导致黑色棋子不连通,黑色同理。

3. 由规则和引理得到的一些推论

推论 1

∘∘∘  ∙→∘∘∘∙∙\def\arraystretch{1.2} \begin{array}{|c|c|c|} \hline \circ & & \circ \\ \hline \circ & \ \ & \bullet \\ \hline \end{array} \rightarrow \begin{array}{|c|c|c|} \hline \circ & & \circ \\ \hline \circ & \bullet & \bullet \\ \hline \end{array}

证明:

∘∘∘  ∙→∘∘∘∘∙→∘∙∘∘∘∙\def\arraystretch{1.2} \begin{array}{|c|c|c|} \hline \circ & & \circ \\ \hline \circ & \ \ & \bullet \\ \hline \end{array} \rightarrow \begin{array}{|c|c|c|} \hline \circ & & \circ \\ \hline \circ & \circ & \bullet \\ \hline \end{array} \rightarrow \begin{array}{|c|c|c|} \hline \circ & \color{red}\bullet & \color{red}\circ \\ \hline \circ & \color{red}\circ & \color{red}\bullet \\ \hline \end{array}

这里红色部分不满足引理 11。

推论 2

∘∘∙∙∙→∘∘∙∙∙∙\def\arraystretch{1.2} \begin{array}{|c|c|c|} \hline & \circ & \circ \\ \hline \bullet & & \\ \hline \bullet & & \bullet \\ \hline \end{array} \rightarrow \begin{array}{|c|c|c|} \hline & \circ & \circ \\ \hline \bullet & & \bullet \\ \hline \bullet & & \bullet \\ \hline \end{array}

证明:

∘∘∙∙∙→∘∘∙∘∙∙→∘∘∙∙∘∙∙→∘∘∙∙∘∙∘∙\def\arraystretch{1.2} \begin{array}{|c|c|c|} \hline & \circ & \circ \\ \hline \bullet & & \\ \hline \bullet & & \bullet \\ \hline \end{array} \rightarrow \begin{array}{|c|c|c|} \hline & \circ & \circ \\ \hline \bullet & & \circ \\ \hline \bullet & & \bullet \\ \hline \end{array} \rightarrow \begin{array}{|c|c|c|} \hline & \circ & \circ \\ \hline \bullet & \bullet & \circ \\ \hline \bullet & & \bullet \\ \hline \end{array} \rightarrow \begin{array}{|c|c|c|} \hline & \circ & \circ \\ \hline \bullet & \color{red}\bullet & \color{red}\circ \\ \hline \bullet & \color{red}\circ & \color{red}\bullet \\ \hline \end{array}

这里红色部分不满足引理 11。

推论 3

∘∘∘∙∙→∘∘∘∘∙∙\def\arraystretch{1.2} \begin{array}{|c|c|c|} \hline \circ & & \circ \\ \hline & & \\ \hline \circ & \bullet & \bullet \\ \hline \end{array} \rightarrow \begin{array}{|c|c|c|} \hline \circ & & \circ \\ \hline & & \circ \\ \hline \circ & \bullet & \bullet \\ \hline \end{array}

证明:

∘∘∘∙∙→∘∘∙∘∙∙→∘∘∘∙∘∙∙→∘∙∘∙∘∙∘∙∙\def\arraystretch{1.2} \begin{array}{|c|c|c|} \hline \circ & & \circ \\ \hline & & \\ \hline \circ & \bullet & \bullet \\ \hline \end{array} \rightarrow \begin{array}{|c|c|c|} \hline \circ & & \circ \\ \hline & & \bullet \\ \hline \circ & \bullet & \bullet \\ \hline \end{array} \rightarrow \def\arraystretch{1.2} \begin{array}{|c|c|c|} \hline \circ & & \circ \\ \hline & \circ & \bullet \\ \hline \circ & \bullet & \bullet \\ \hline \end{array} \rightarrow \begin{array}{|c|c|c|} \hline \color{red}\circ & \color{red}\bullet & \circ \\ \hline \color{red}\bullet & \color{red}\circ & \bullet \\ \hline \circ & \bullet & \bullet \\ \hline \end{array}

这里红色部分不满足引理 11。

推论 4

∘∘∘∘→∘∘∙∘∘\def\arraystretch{1.2} \begin{array}{|c|c|c|} \hline \circ & \circ & \\ \hline & & \circ \\ \hline & \circ & \\ \hline \end{array} \rightarrow \begin{array}{|c|c|c|} \hline \circ & \circ & \\ \hline \bullet & & \circ \\ \hline & \circ & \\ \hline \end{array}

证明:

∘∘∘∘→∘∘∘∘∘→∘∘∘∙∘∘\def\arraystretch{1.2} \begin{array}{|c|c|c|} \hline \circ & \circ & \\ \hline & & \circ \\ \hline & \circ & \\ \hline \end{array} \rightarrow \begin{array}{|c|c|c|} \hline \circ & \circ & \\ \hline \circ & & \circ \\ \hline & \circ & \\ \hline \end{array} \rightarrow \begin{array}{|c|c|c|} \hline \circ & \circ & \\ \hline \circ & \color{red}\bullet & \circ \\ \hline & \circ & \\ \hline \end{array}

这里红色部分不满足规则 22。

推论 5

∘∘∙∘∙→∘∘∙∙∘∙\def\arraystretch{1.2} \begin{array}{|c|c|c|} \hline \circ & & \circ \\ \hline \bullet & & \\ \hline & \circ & \bullet \\ \hline \end{array} \rightarrow \begin{array}{|c|c|c|} \hline \circ & & \circ \\ \hline \bullet & & \bullet \\ \hline & \circ & \bullet \\ \hline \end{array}

证明:

∘∘∙∘∙→∘∘∙∘∘∙→∘∘∙∘∘∘∙→∘∘∘∙∘∘∘∙\def\arraystretch{1.2} \begin{array}{|c|c|c|} \hline \circ & & \circ \\ \hline \bullet & & \\ \hline & \circ & \bullet \\ \hline \end{array} \rightarrow \begin{array}{|c|c|c|} \hline \circ & & \circ \\ \hline \bullet & & \circ \\ \hline & \circ & \bullet \\ \hline \end{array} \rightarrow \begin{array}{|c|c|c|} \hline \circ & & \circ \\ \hline \bullet & \circ & \circ \\ \hline & \circ & \bullet \\ \hline \end{array} \rightarrow \begin{array}{|c|c|c|} \hline \circ & \color{red}\circ & \color{red}\circ \\ \hline \bullet & \color{red}\circ & \color{red}\circ \\ \hline & \circ & \bullet \\ \hline \end{array}

这里红色部分不满足规则 11。

4. 一些其它的东西

4.1 偶数边长

若棋盘尺寸 2∣n2 \mid n,则 (1,2x)(1,2x) 与 (1,2x+1)(1,2x+1) 同色,棋盘下面,左面,右面同理。

4.2 山洞

∘∘∘∘∘∘∘∘∘∘∘∘\def\arraystretch{1.2} \begin{array}{|c|c|c|c|c|c|} \hline \circ & \circ & \circ & \circ & \circ & \circ \\ \hline \\ \hline \circ & \circ & \circ & \circ & \circ & \circ \\ \hline \end{array}

这种东西就叫山洞。

∘∘∘∘∘∘∙∙∙∙∘∘∘∘∘∘\def\arraystretch{1.2} \begin{array}{|c|c|c|c|c|c|} \hline \circ & \circ & \circ & \circ & \circ & \circ \\ \hline & \bullet & \bullet & \bullet & \bullet\\ \hline \circ & \circ & \circ & \circ & \circ & \circ \\ \hline \end{array}

如上图,可以确定一排棋子。 山洞可以在棋盘边缘。此时可以只有一排棋子。如下图:

∘∘∘∘∘∘\def\arraystretch{1.2} \begin{array}{|c|c|c|c|c|c|} \hline \circ & \circ & \circ & \circ & \circ & \circ \\ \hline \\ \hline \hline \end{array}

此时可能性质不那么好,具体地,山洞内部可以有 ≤1\le 1 个和山洞外壁颜色相同的棋子。不过结合引理 22 仍然可以确定一些棋子。

5. 分层练习

提供 88 个难度不同的练习。建议完成 1∼41 \sim 4。

5.1 练习 11

5.2 练习 22

5.3 练习 33

5.4 练习 44

5.5 练习 55

5.6 练习 66

5.7 练习 77

5.8 练习 88

6. OI 练习

题目:UVA10572。

求阴阳的解数以及任意解,n×mn \times m 的棋盘,TT 组数据。

1≤n,m≤8,1≤T≤1001 \le n,m \le 8,1 \le T \le 100

正解好像是轮廓线 DP,可是我不会 \ll。

原文