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

12010번 - Landscaping 다국어

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

문제

Farmer John is building a nicely-landscaped garden, and needs to move a large amount of dirt in the process.

The garden consists of a sequence of \(N\) flowerbeds (\(1 \leq N \leq 100,000\)), where flowerbed \(i\) initially contains \(A_i\) units of dirt. Farmer John would like to re-landscape the garden so that each flowerbed \(i\) instead contains \(B_i\) units of dirt. The \(A_i\)'s and \(B_i\)'s are all integers in the range \(0 \ldots 10\).

To landscape the garden, Farmer John has several options: he can purchase one unit of dirt and place it in a flowerbed of his choice for \(X\) units of money. He can remove one unit of dirt from a flowerbed of his choice and have it shipped away for \(Y\) units of money. He can also transport one unit of dirt from flowerbed \(i\) to flowerbed \(j\) at a cost of \(Z\) times \(|i-j|\). Please compute the minimum total cost for Farmer John to complete his landscaping project.

입력

The first line of input contains \(N\), \(X\), \(Y\), and \(Z\) (\(0 \leq X, Y \le 10^8; 0 \le Z \leq 1000\)). Line \(i+1\) contains the integers \(A_i\) and \(B_i\).

출력

Please print the minimum total cost FJ needs to spend on landscaping.

제한

예제 입력 1

4 100 200 1
1 4
2 3
3 2
4 0

예제 출력 1

210

힌트

Note that this problem has been asked in a previous USACO contest, at the silver level; however, the limits in the present version have been raised considerably, so one should not expect many points from the solution to the previous, easier version.

출처

Olympiad > USA Computing Olympiad > 2015-2016 Season > USACO US Open 2016 Contest > Platinum 3번

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

출처

대학교 대회

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

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