Envious Pile
You have $2$ piles of stones. Initially, one pile has $0$ stones, and the other has $1$ stone with weight $W$. You have $N$ boxes where the $i^{th}$ box contains infinite number of stones, each with weight $A_i$ such that $A_i \lt A_{i + 1}$ for all $1 \le i \lt N$. One move is defined in the following way: - Choose a box and take exactly one stone from that box; - Add the stone to the **lighte
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