← All problemsSign in

1-2 Game

There are two players $P_1$, $P_2$ playing a game on an array $A$ which has $n$ positive integers: $A_1, A_2, \ldots, A_n$. Both the players take turns alternatively, and $P_1$ goes first. The rules of the game are as follows: - In $P_1$’s turn, he should choose any element $A_i$ which is $\ge 1$, and subtract $1$ from it. - In $P_2$’s turn, he should choose any element $A_i$ which is $\ge 2$, an

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start