QOJ.ac

QOJ

时间限制: 1 s 内存限制: 256 MB 总分: 100

#11350. 古老围棋

统计

Yu Zhou 喜欢和 Su Lu 下“围棋”。通过历史研究,我们发现古代围棋和现代围棋的规则有很大不同。

他们所玩的古代围棋规则如下:

  • 游戏在一个 $8 \times 8$ 的棋盘上进行,棋子可以放在棋盘线的交点上,因此共有 $9 \times 9$ 个不同的落子位置。
  • Yu Zhou 执黑棋,Su Lu 执白棋。他们轮流在棋盘上落子。
  • 相同颜色的棋子构成连通块(通过棋盘线连接)。对于每一个连通块,如果它不与任何空位相邻,则该连通块死亡并从棋盘上移除。
  • 当一方落子后,首先检查对手的连通块。在移除对手的死子后,再检查该玩家自己的连通块并移除其中的死子。

有一天,Yu Zhou 正在家里和 Su Lu 下古代围棋。现在轮到 Yu Zhou 落子了。但他们不得不去执行一项紧急军事行动。Little Qiao 看着棋盘,想知道 Yu Zhou 是否有一步棋可以吃掉 Su Lu 的至少一个棋子。

输入格式

输入的第一行给出了测试用例的数量 $T$ ($1 \le T \le 100$)。接下来是 $T$ 个测试用例。

测试用例之间由空行分隔。每个测试用例包含 9 行,代表棋盘。每行包含 9 个字符。每个字符代表棋盘上的一个位置。'.' 代表空位,'x' 代表 Yu Zhou 的黑棋,'o' 代表 Su Lu 的白棋。

输出格式

对于每个测试用例,输出一行 "Case #x: y",其中 $x$ 是测试用例编号(从 1 开始),如果 Yu Zhou 有一步棋可以吃掉 Su Lu 的至少一个连通块,则 $y$ 为 "Can kill in one move!!!",否则为 "Can not kill in one move!!!"。

样例

输入 1

2
.......xo
.........
.........
..x......
.xox....x
.o.o...xo
..o......
.....xxxo
....xooo.
......ox.
.......o.
...o.....
..o.o....
...o.....
.........
.......o.
...x.....
........o

输出 1

Case #1: Can kill in one move!!!
Case #2: Can not kill in one move!!!

说明

在第一个测试用例中,Yu Zhou 有 4 种不同的方法可以吃掉 Su Lu 的连通块。 在第二个测试用例中,没有方法可以吃掉 Su Lu 的连通块。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.