Split or Decrease
Chef and Chefina are playing a game. **Chef plays first**. There are $N$ piles where the $i^{th}$ pile contains $A_i$ stones. In his/her turn, a player can do **one** of the following: - Take any non-empty pile and remove $1$ stone from it. - Take any pile containing atleast $2$ stones and split it into two piles containing $X$ and $Y$ stones such that $X+Y$ equals the initial number of stones
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.
Sign in to chat with the tutor and save your progress.
Sign in to start