← All problemsSign in

Chef & Cook Game

CodeChefRating 1888Open on judge ↗

There is a non-negative integer array $A$ of length $N$. Chef and Cook will play a game on the array with Chef starting first. In one turn the player will perform the following operation: - Choose two indices $i,j$ such that $1 \leq i \lt j \leq N$ and $A_i > 0$. - Set $A_i \gets A_i - 1$ and $A_j \gets A_j + 1$, i.e, subtract $1$ from $A_i$ and add $1$ to $A_j$. The player who is unable to per

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