阴阳
Hamburger999
·
·
休闲·娱乐
1. 规则介绍
阴阳是一个解谜游戏。网址:this。
规则:有一个 n \times n 的棋盘,上面有一些固定的黑子和白子,其余的位置均为空。
你要将空位置填上黑子和白子,使得:
- 黑子和白子各自形成一个四连通块;
- 不存在 2 \times 2 的方阵区域使得这里的棋子颜色相同。
如下是一个谜题和解答:
2. 一些引理
2.1 引理 1
不存在 2 \times 2 的方阵区域,使得两条对角线上的棋子均相同。
情况 1:如红色区域,这不符合规则 2;
情况 2:如黑色区域,这会导致某种颜色不四连通(显然)。这不符合规则 1;
2.2 引理 2
边缘线上的某种颜色棋子(黑/白)的极长连续段不会 \ge 2 条。
如上图,白色棋子在边缘构成了 2 个极长连续段,若将它们连通则会导致黑色棋子不连通,黑色同理。
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}
这里红色部分不满足引理 1。
推论 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}
这里红色部分不满足引理 1。
推论 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}
这里红色部分不满足引理 1。
推论 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}
这里红色部分不满足规则 2。
推论 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}
这里红色部分不满足规则 1。
4. 一些其它的东西
4.1 偶数边长
若棋盘尺寸 2 \mid n,则 (1,2x) 与 (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}
此时可能性质不那么好,具体地,山洞内部可以有 \le 1 个和山洞外壁颜色相同的棋子。不过结合引理 2 仍然可以确定一些棋子。
5. 分层练习
提供 8 个难度不同的练习。建议完成 1 \sim 4。
5.1 练习 1
5.2 练习 2
5.3 练习 3
5.4 练习 4
5.5 练习 5
5.6 练习 6
5.7 练习 7
5.8 练习 8
6. OI 练习
题目:UVA10572。
求阴阳的解数以及任意解,n \times m 的棋盘,T 组数据。
1 \le n,m \le 8,1 \le T \le 100
正解好像是轮廓线 DP,可是我不会 \ll。