Because of maintenance, it is currently impossible to submit any solutions.
The maintenance will end around 3:00 am GMT (4:00 am SPOJ time).
This message will disappear once the maintenance is finished.
SPOJ Problem Set (classical)
13303. Tic-tac-toe 3
Problem code: OVOXO
Bored to death working at the Byteland Office...your colleagues have resorted to game of crosses Xs and naughtd Os or Tic-tac-toe. One of them keeps on losing and is tired of the jokes. He plans to have an Android app in his phone to help him out. He is your good friend and seeks your assistance. "Treat at ANC is guaranteed", he says.
He also is very frugal when it comes to memory usage. So please don't write a long if else chain...cause you have to do the task within 999 bytes
An integer T - the number of test cases. (T<1000). T test cases follow.
Each test case comprises 3 strings each separated by newline and containing exactly 3 characters(either 'X','O' or '_') per line. An empty line follows each test case. Each input position is guaranteed to be a valid tic tac toe position such that the game is still not over.
For each test case print "WON" if it is a sure shot winning position. Else print "CONTINUE". Then output the game after having made your move. If more than one move are equally good try playing the move on the first empty spot.
Info1) iguaranteed always to be X's move (it is the standard) and whose move it currently is can be computed...
2) winning position is meant for the current player
3) winning in lesser number of moves is better and drawing is better than losing as in general AI
4) you need to print the board as it looks after making the best move
5) print WIN if the current player can win in the case when both players play optimally from here on...