← All problemsSign in

Make Money

CodeChefRating 1101Open on judge ↗

Chef has $N$ bags and an integer $X$. The $i^{th}$ bag contains $A_i$ coins such that $A_i \leq X$. In one operation, Chef can: - Pick any bag and increase its coins to $X$. Formally, if he choses the $i^{th}$ bag, he can set $A_i = X$. Given that the cost of performing **each** operation is $C$ $(C \leq X)$ coins and Chef can perform the above operation any (possibly zero) number of times, de

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