Problem 3987 · Medium

Minimum Total Cost to Process All Elements

A tank starts with k free units and each demand drains it. Refills of fixed size cost more each time, so buy only when a demand cannot be covered and add up the escalating prices.

Open the interactive visualisation