TWONIM - Editorial

Your code gives wrong answer for this test case.

1

3

1 2 3

Your answer - Second

Correct answer - First

xor is 0 when we have two same values,so why is it that the above questions centers around even and odd rather missing the possibility of having all same no. of stones in piles or having odd/even no. of piles?

A really good problem, was XORing all the elements but overthinking of the corner cases didnā€™t allow me to submit even a single solution.

check for this test case also

1

6

3 3 2 2 5 6

Your Ans : Second

Correct Ans : First(According to accepted solutionā€¦here is solution link ā€¦

https://www.codechef.com/viewsolution/9711632

)

Happy coding

I got itā€¦1 2 3 is the case I was looking for!

Love the way codechef provides the detailed explanation of problem