Problem 2980 --Game

2980: Game

"
Time Limit $4$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $0$ 正确数量 $0$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签
Alice and Bob are playing a game again. The game can be described as follows: 

A chess board sized 3×33×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 44states: 

 ∙∙ "."    means that it is empty. 
 ∙∙ "O"    means that it contains a white chess piece. 
 ∙∙ "X"    means that it contains a black chess piece. 
 ∙∙ "#"    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)(x,y) containing a white chess piece, and firstly ban the cell (x,y)(x,y), and then she must choose one of the following three additional operations: 

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

Note that if Alice chooses the first one, the two cells (x,y−1)(x,y−1) and (x,y+1)(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)(x,y) containing a black chess piece, and firstly ban the cell (x,y)(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 nn, and nnstates 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 "AliceAlice   without quotes. 

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

If the first player always wins, no matter who is the first player, output "FirstFirst   without quotes. 

If the second player always wins, no matter who is the first player, output "SecondSecond   without quotes. 

If none of the situations would output, then output "OthersOthers   without quotes please.
The first line contains the only integer TTdenoting the number of the test cases. 

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

For each state, you should read an empty line firstly, and then a 3×33×3 chessboard. 
To be beautiful and striking, the chessboard is actually a 3×53×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 nn in all test cases is no larger than 11000001100000

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

推荐代码 查看2980 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$ $ms]
内存最少[$ $KB]
第一AC
第一挑战

赛题来源/所属竞赛 2019 Multi-University Training Contest 2 N/A

竞赛编号 竞赛名称 竞赛时间 访问比赛