← All problemsSign in

Game on Array

CodeChefRating 2389Open on judge ↗

Alice and Bob play a game with $N$ piles of stones where the $i^{th}$ pile has $A_i$ stones initially. They take alternate turns starting with Alice. On Alice's turn, she will: - Choose indices $i$ and $j \ (1 \le i, j \le N)$ where $i$ and $j$ have the **same** [parity](https://en.wikipedia.org/wiki/Parity_(mathematics)). - Remove $1$ stone each from piles $i$ and $j$. - Note that both pil

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