← All problemsSign in

Ankit, Srijan and a game of stone piles

CodeChefRating 2477Open on judge ↗

There are N piles of stones, where i-th pile has Ai stones. A game is played on these piles, in order from pile 1 to N. When the game is on the i-th pile, a player can remove any non-zero number of stones from this pile in a single move. If the current pile becomes empty, the game moves on to the next pile. The player who is unable to make a move loses. Srijan and Ankit are going to play this gam

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