TRIOMINO - Triomino Game

no tags 

X and Y are playing the following game: They start with an empty 2xN board and move alternately. X moves first. In a move, a player must place an L-triomino (shown on the right), in any of the 4 possible orientations, on the board. The piece placed must not overlap with a piece that has already been placed. The player that is unable to make a valid move loses.

Given the size of the board, find out who will win the game assuming that both X and Y play optimally


Input consists of multiple test-cases. The first line contains a single integer T, the number of test cases. (T<=50)

Each test-case consists of a single line containing a single integer N, the size of the board. (N<=800)


For each test-case, output a single line containing "X" or "Y" depending on who wins that game.




hide comments
Tahsin: 2016-03-17 18:31:36

the image is not visible :/

=(Francky)=> Fixed.

Last edit: 2016-03-17 21:52:52
laurfan: 2014-12-25 22:40:00

the board dimension is alwys 2xN (can only has 2 rows)?

Last edit: 2014-12-25 22:50:26
Akshay Jaggi: 2013-04-19 11:54:35

Can I place the L-triomino anywhere on the board, or it must be just placed next to a already placed one?

Added by:Race with time
Time limit:0.790s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ERL JS-RHINO NODEJS PERL6 VB.NET
Resource:Byte Code