Logo
(追記) (追記ここまで)

33500번 - Watering the Plants 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 2048 MB643100.000%

문제

Bessie's garden has $N$ plants labeled 1ドル$ through $N$ (2ドル\leq N\leq 5\cdot 10^5$) from left to right. Bessie knows that plant $i$ requires at least $w_i$ (0ドル\leq w_i \leq 10^6$) units of water.

Bessie has a very peculiar irrigation system with $N-1$ canals, numbered 1ドル$ through $N-1$. Each canal $i$ has an associated unit cost $c_i$ (1ドル\le c_i\le 10^6$), such that Bessie can pay $c_i k$ to provide plants $i$ and $i+1$ each with $k$ units of water, where $k$ is a non-negative integer.

Bessie is busy and may not have time to use all the canals. For each 2ドル\leq i \leq N$ compute the minimum cost required to water plants 1ドル$ through $i$ using only the first $i-1$ canals.

입력

The first line contains a single positive integer $N$.

The second line contains $N$ space-separated integers $w_1, \ldots, w_N$.

The third line contains $N-1$ space-separated integers $c_1, \ldots, c_{N-1}$.

출력

Output $N-1$ newline-separated integers. The $(i-1)$th integer should contain the minimum cost to water the first $i$ plants using the first $i-1$ canals.

제한

예제 입력 1

3
39 69 33
30 29

예제 출력 1

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

예제 출력 2

1558
676

예제 입력 3

8
35 89 44 1 35 3 62 50
7 86 94 62 63 9 49

예제 출력 3

623
4099
4114
6269
6272
6827
8827

힌트

출처

Olympiad > USA Computing Olympiad > 2024-2025 Season > USACO 2025 January Contest > Platinum 3번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /