← All problemsSign in

Dual Nim

CodeChefRating 2031Open on judge ↗

Nim is a well-known combinatorial game, based on removing stones from piles. In this problem, we'll deal with a similar game, which we'll call Dual Nim. The rules of this game are as follows: - Initially, there are N piles of stones, numbered 1 through N. The i-th pile contains ai stones. - The players take alternate turns. If the bitwise XOR of all piles equals 0 before a player's turn, then th

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