← All problemsSign in

Avoid Wasting

Today Tomya buys N retort pouches of food in Chef Ciel's restaurant. The i-th retort pouch contains Vi units of food, and its use-by date is the Ui-th day (1-origin). Moreover, food from the i-th retort pouch can be eaten only within Li days after it was opened. Namely, if Tomya will open the i-th retort pouch on the xi-th day, she can eat food units from it on the k-th day if and only if xi ≤ k ≤

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