← All problemsSign in

G - Infinite Operations

Alice has $N$ boxes, numbered $1$ to $N$, where the $i$-th box contains $A_i$ stones. Alice can perform the following two-step operation: - Pick two different boxes, say $X$ and $Y$, such that the number of stones in box $X$ and box $Y$ **are not equal**. - Then, move exactly $1$ stone from the box with more stones to the box with lesser stones. For example, if $A_X > A_Y$, she will remove $

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