Submit | All submissions | Best solutions | Back to list |
ADV04A1 - Tower Game (Hard) |
Daniel is building towers out of blocks. He has many black and white blocks. He has built n towers out of those. Now he suggests Max playing the following game. Black block will belong to Daniel and white blocks will be Max's blocks. During his turn the player can take any of his blocks from any tower and remove it and all the blocks above it. As usual the player who can't make the move loses. Daniels make the first move. Determine who will win if both players play optimally.
Input
The input starts with number t - the amount of test cases. The first line of each test is number n - the number of towers. Then n strings follow. Each string is formed of 'B' and 'W' characters, where 'B' means black block and 'W' means white block. Each string describes one tower from bottom to top.
Constraints
1 <= t <= 20
1 <= n <= 1000
String consist of no less than 1 character and no more than 1000 characters.
Output
For each test case print 'Win' if Daniel wins and 'Loss' if Max wins given both players play optimally.
Example
Input: 1 5 BBWWB BWBB BB WWW WB Output: Win
Beware! Much input data.
Added by: | Spooky |
Date: | 2010-11-14 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | Advancement Autumn 2010, http://sevolymp.uuuq.com/ |