← All problemsSign in

Piles Parity

CodeChefRating 2767Open on judge ↗

Chef and Chefina are playing a game involving $N$ piles where the $i^{th}$ pile $(1\le i \le N)$ has $A_i$ stones initially. They take alternate turns with Chef starting the game. In his/her turn a player can choose any **non-empty** pile (say $i^{th}$ pile) and remove $X$ stones from it iff: - [Parity](https://en.wikipedia.org/wiki/Parity_(mathematics)) of $X$ is **same** as parity of $i$. - $

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