Watering the Plants
시간 제한2초메모리 제한2048 MB
각 식물 접두사마다 그 안의 수로만 써서 모든 식물의 물 요구량을 채우는 최소 비용을 구한다.
문제
Bessie's garden has plants labeled through () from left to right. Bessie knows that plant requires at least () units of water.
Bessie has a very peculiar irrigation system with canals, numbered through . Each canal has an associated unit cost (), such that Bessie can pay to provide plants and each with units of water, where is a non-negative integer.
Bessie is busy and may not have time to use all the canals. For each compute the minimum cost required to water plants through using only the first canals.
입력
The first line contains a single positive integer .
The second line contains space-separated integers .
The third line contains space-separated integers .
출력
Output newline-separated integers. The th integer should contain the minimum cost to water the first plants using the first canals.