← All problemsSign in

Must Eat Candies

mystic_tc is sitting in front of a table. He found N sealed boxes of candies on the table. He is not sure how many candies each box contains. However, he knows the following information: The total number of candies in the boxes is C. For each i, box i (0-based index) contains between 0 and high[i] candies, inclusive. You know that mystic_tc eats candies as follows: first he chooses a subset 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