← All problemsSign in

M & Chocolate

Sandhya is very fond of a chocolate $C$. She wants to buy exactly $K$ chocolates of this type from $K$ different shops, one from each shop. She has a list $A$ of the cost of chocolate $C$ of size $N$. She wants to spend the minimum possible amount. Also, she doesn't want two chocolates of the same price, i.e if she has purchased a chocolate with price 5, she will not go to other shops which offer

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