← All problemsSign in

Stack the Stones

Jayesh recently went on a trip to Japan and fell in love with the ancient Japanese art of stone stacking/rock balancing. Mesmerized by it, he now wants to try it out himself. He bought $N$ rocks each having a width $W_i$ and cost $C_i$. While returning he met a priest who told him the ancient trick of balancing the stones - "an arrangement with $k$ stones will be balanced only if more than half of

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