#P3858. [TJOI2008] 贪吃蛇
[TJOI2008] 贪吃蛇
Description
Jiajia and Jinming are very smart and always play optimally. Since the snake’s starting position is chosen by Jiajia, she wants to know whether she can pick a starting cell that guarantees her a win.
Input Format
The first line contains an integer N, the number of test cases. Each test case begins with a line containing three integers H, R, and C, denoting the height, length, and width of the rectangular prism. Then follow H matrices of R rows and C columns; each matrix describes one layer of the prism. Each matrix contains only the characters '.' and 'X', where '.' means a cell initially with food and 'X' means an obstacle. The H layer descriptions are separated by a blank line.
Output Format
Output N lines, each indicating whether Jiajia can guarantee a win in the corresponding game. Output "yes" if she can, otherwise output "no".
2
2 2 3
...
X.X
X.X
XXX
2 2 3
.X.
.X.
.X.
.X.
yes
no
Hint
- For 40% of the testdata, .
- For 100% of the testdata, , .
- The input guarantees that each rectangular prism contains at least one cell that is not an obstacle.
Translated by ChatGPT 5
京公网安备 11011102002149号