#PU1478. USACO 2025 January Contest, Platinum — Problem 3. Watering the Plants
USACO 2025 January Contest, Platinum — Problem 3. Watering the Plants
USACO 2025 January Contest, Platinum — Problem 3. Watering the Plants
题目描述
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 .
输出格式
(见题面原文)
数据范围
(见题面原文)
样例
样例 1
3
39 69 33
30 29
2070
2127
The minimum cost to water the first $2$ plants using the first canal is to pay
$30 \cdot 69 = 2070$ by using the first canal $69$ times.
The minimum cost to water the first $3$ plants is to use the first canal $39$
times and the second canal $33$ times, paying
$39 \cdot 30 + 29 \cdot 33 = 2127$.
样例 2
3
33 82 36
19 1
1558
676
样例 3
8
35 89 44 1 35 3 62 50
7 86 94 62 63 9 49
623
4099
4114
6269
6272
6827
8827