← All problemsSign in

Ice Cream Queue

CodeChefRating 2382Open on judge ↗

There are $N$ people standing in a queue for Chef's ice cream. They are numbered $1$ through $N$ from the front to the back of the queue. Chef's customers do not like to wait too long. For each valid $i$, we know that the ice cream ordered by the $i$-th person will take $P_i$ seconds to prepare and cost $V_i$ units of money, but if this person has to wait strictly more than $W_i$ seconds in the q

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