6 - Shifting Spoons
CodeChefOpen on judge ↗
You have $N$ piles of spoons numbered $1, 2, \ldots, N$. Initially the $i$-th pile contains $A_i$ spoons. In a single operation, you can do the following: - Choose three integers $p, q, x$ satisfying $1 \leq p, q \leq n$, $p \neq q$, $1 \leq x \leq A_p \leq A_q$. Shift $x$ spoons from pile $p$ to pile $q$, that is, add $x$ to $A_q$ and subtract $x$ from $A_p$. You want to shift all spoons
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.
Sign in to chat with the tutor and save your progress.
Sign in to start