Wrong submission for Mix Mix Game

For August LunchTime Mix Mix Game(CodeChef: Practical coding for everyone)

After seeing the editorial explanation, my approach was to find if

  1. for first turn check if adding or
    subtracting of a number leads to z1
    or z2
    • if so, player 1 wins
  2. for second turn, choose a pair of number from the array, say “a” and
    “b”
    • calculate a+b, a-b, -a+b, -a-b
    • check if any one of them is equal to z1 or z2
    • if so, then second player wins
  3. Else tie

Here I have implemented my logic.
Where am I doing wrong?

I didn’t read code, but with given explanation, this should be wrong case for your appraoch:

n=2, Z_1=5, Z_2=5

A={2, 3}

In this case answer is Tie: first player can put -3 and copy next moves of second player.

Because of my wrong interpretation, I had a series of wrong submission XD. Thanks man, you saved my day.