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

19456번 - Cocktails 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 256 MB95191624.242%

문제

A party is coming tonight, and drinks are not ready yet! You are going to prepare a cocktail for your friends. The cocktail consists of $n$ different ingredients. There are $n$ jars in front of you, numbered from left to right starting from 1. Each of the jars contains a single ingredient. You have to blend each ingredient in its separate jar.

Blending the contents of $i$-th jar by hand takes $a_i$ seconds. Also, you have a very powerful blender which can blend the contents in any $k$ subsequent jars in $B$ seconds (the blender can be applied any number of times). Finally, you can swap any two jars in $C$ seconds (the two jars don't have to be adjacent). It is allowed to blend the contents of any jar more than once.

What is the smallest possible time to blend the ingredients in all $n$ jars? The final order of jars does not matter as long as they are all blended.

입력

In the first line of input there are four space-separated integers $n,ドル $k,ドル $B,ドル $C$ (1ドル \leq k \leq n \leq 500,ドル 1ドル \leq B, C \leq 10,000円$) --- the number of jars, the reach of the blender, the time needed to use the blender, and the time needed to swap two jars respectively.

In the second line there are $n$ space-separated integers $a_1,ドル $\ldots,ドル $a_n$ (1ドル \leq a_i \leq 10,000円$), where $a_i$ is the time needed to manually blend the contents of $i$-th jar.

출력

Print a single integer --- the smallest time needed to blend the contents in all jars.

제한

예제 입력 1

5 2 10 3
10 1 20 2 3

예제 출력 1

19

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2016 > Day 3: Moscow IPT Contest C번

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

출처

대학교 대회

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

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