FOOLS18F-Editorial

PROBLEM LINK:

Practice

Contest

Author: Harshit Patni

Tester: Harshit Patni and Nikhil Gogate

First To Solve: Frank Tinkelenberg

DIFFICULTY:

Special Problem : Hard

PROBLEM:

Forgotten game

You are a brogrammer in 3018 who has found a pen drive. The pen drive contains data of the game which was played to put an end to war between PRIME ministers of two superpowers in 2018. You found 3 numbers in pen drive. Now it is your task to determine winner of the forgotten war by determining result of forgotten game. War results in 3 outcomes Superpower 0 won, Superpower 1 won or draw.

HINTS:

The game being referred here is Tic-Tac-Toe . The final state of board is formed by 3 integers which are constrained to be between 0 and 7 ( it was hint to 3 bit numbers ).
Hint for using binary representation was also given by using superpowers as s0 and s1.
First test case (6, 4, 1) can be written by converting into their binary representation as:

110

100

001

This is the final board state of tic-tac-toe game with ‘1’ as one player and ‘0’ as another player.
Here ‘0’ wins by getting 3 consecutive zeros in the third diagonal. From the sample test case it is clear that ‘0’ is being called ‘s0’.
Similarly second test case(2, 6, 5) can be deciphered as:

010

110

101

This state is draw.

SOLUTION

here