#P11678. [USACO25JAN] Watering the Plants P
[USACO25JAN] Watering the Plants P
Description
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.
Input Format
The first line contains a single positive integer .
The second line contains space-separated integers .
The third line contains space-separated integers .
Output Format
Output newline-separated integers. The th integer should contain the minimum cost to water the first plants using the first canals.
3
39 69 33
30 29
2070
2127
3
33 82 36
19 1
1558
676
8
35 89 44 1 35 3 62 50
7 86 94 62 63 9 49
623
4099
4114
6269
6272
6827
8827
Hint
For Sample 1:
The minimum cost to water the first plants using the first canal is to pay by using the first canal times.
The minimum cost to water the first plants is to use the first canal times and the second canal times, paying .
SCORING:
- Input 4: , and all .
- Inputs 5-6: All .
- Inputs 7-10: .
- Inputs 11-14: All and are generated independently and uniformly at random.
- Inputs 15-19: No additional constraints.
京公网安备 11011102002149号