RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
USACO0650

Watering the Plants

Diamond III 다이아몬드 III
난이도
2s
시간 제한
256MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

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.

Problem credits: Benjamin Qi

제약

SCORING

  • Input 4: \(N \leq 200\), and all \(w_i \leq 200\).
  • Inputs 5-6: All \(w_i \leq 200\).
  • Inputs 7-10: \(N \leq 5000\).
  • Inputs 11-14: All \(w_i\) and \(c_i\) are generated independently and uniformly at random.
  • Inputs 15-19: No additional constraints.

Problem credits: Benjamin Qi

입력 형식

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
출력
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
문제 정보

riseoj 작성

출처 올림피아드 > USACO > 2024-2025 > January > Platinum

태그

평가 및 의견

Watering the Plants

개요
출제자 난이도 Diamond III 다이아몬드 III 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Watering the Plants

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8