当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6597:Game

题目描述
Alice and Bob are playing a game again. The game can be described as follows:

A chess board sized $3 \times 3$ is used for the game. But some cells in it have been banned before the game, which implies that no one could place a chess piece onto it. And some chess pieces have been placed on some cells, while some other cells remain empty. In a word, a cell can be in $4$ states:

$\quad$ $\bullet$ "." $\space$ means that it is empty.
$\quad$ $\bullet$ "O" $\space$ means that it contains a white chess piece.
$\quad$ $\bullet$ "X" $\space$ means that it contains a black chess piece.
$\quad$ $\bullet$ "#" $\space$ means that it is banned.

There is no doubt that no two chess pieces can be placed onto the same cell whenever. Alice can operate white chess pieces and Bob can operate black chess pieces.

If it is Alice's turn, she should choose some cell $(x,y)$ containing a white chess piece, and firstly ban the cell $(x,y)$, and then she must choose one of the following three additional operations:

$\quad$ $\circ$ $\space$ ban the two cells next to the cell $(x,y)$ on the left and right.
$\quad$ $\circ$ $\space$ ban the two cells next to the cell $(x,y)$ which lie above and below $(x,y)$.
$\quad$ $\circ$ $\space$ operate both of the aforementioned two.

Note that if Alice chooses the first one, the two cells $(x,y-1)$ and $(x,y+1)$ could be not in the actually chessboard, she would just ban the cell(s) in the chessboard. But it is not meant that she cannot choose the first option. Namely, the actual effect of the three options could be the same.

If it is Bob's turn, he should choose some cell $(x,y)$ containing a black chess piece, and firstly ban the cell $(x,y)$, and then eat some melon seeds. Yes, actually he can do nothing additionally.

Whoever cannot operate on his turn loses, i.e. the other one is the winner of the game. As we all know, Alice and Bob always try their best to win and we can assume that they are smart enough.

The number of different states of the chessboard may be large. And for each one, we can make out who would be the winner and give some analysis before the game actually starts.

Today, Alice and Bob are playing many games simultaneously of the kind described above. Every someone's turn is to choose any game he can operate on to play. And no one can skip any his turn and do nothing.

You will be given a positive integer $n$, and $n$ states of games denoting the total state of the whole game. Make out who would be the winner.

If Alice always wins, no matter who is the first player, output "$Alice$" $\space$ without quotes.

If Bob always wins, no matter who is the first player, output "$Bob$" $\space$ without quotes.

If the first player always wins, no matter who is the first player, output "$First$" $\space$ without quotes.

If the second player always wins, no matter who is the first player, output "$Second$" $\space$ without quotes.

If none of the situations would output, then output "$Others$" $\space$ without quotes please.
输入解释
The first line contains the only integer $T$ denoting the number of the test cases.

Each case begins with an empty line and another line containing the only integer $n$ denoting the number of the states of the games. The following are the $n$ states.

For each state, you should read an empty line firstly, and then a $3 \times 3$ chessboard.
To be beautiful and striking, the chessboard is actually a $3 \times 5$ char-array. For each line, the chess pieces are separated by an additional character | as you can see in the following examples.

It is guaranteed that the sum of $n$ in all test cases is no larger than $1100000$.

See examples for better understanding.
输出解释
Output one line per testcase containing one word from the set $\{$ ``Alice'' , ``Bob'' , ``First'' , ``Second'' , ``Others'' $\}$. The words' exact meannings have been explained as above.
输入样例
1

2

#|X|O
O|#|X
#|.|X

X|#|.
X|#|O
O|#|.
输出样例
Alice
来自杭电HDUOJ的附加信息
Recommend liuyiding

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6597

最后修改于 2020-10-25T23:32:41+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
8000/4000MS(Java/Others) 131072/131072K(Java/Others)