結果

問題 No.1071 ベホマラー
ユーザー freecss00freecss00
提出日時 2020-06-05 21:53:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 247 ms / 2,000 ms
コード長 329 bytes
コンパイル時間 97 ms
コンパイル使用メモリ 10,896 KB
実行使用メモリ 21,680 KB
最終ジャッジ日時 2023-08-22 15:11:52
合計ジャッジ時間 4,726 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,844 KB
testcase_01 AC 15 ms
7,764 KB
testcase_02 AC 15 ms
7,796 KB
testcase_03 AC 16 ms
7,780 KB
testcase_04 AC 16 ms
7,720 KB
testcase_05 AC 16 ms
7,876 KB
testcase_06 AC 16 ms
7,768 KB
testcase_07 AC 16 ms
7,844 KB
testcase_08 AC 16 ms
7,776 KB
testcase_09 AC 16 ms
7,768 KB
testcase_10 AC 209 ms
19,068 KB
testcase_11 AC 203 ms
18,580 KB
testcase_12 AC 135 ms
15,044 KB
testcase_13 AC 171 ms
17,676 KB
testcase_14 AC 212 ms
19,572 KB
testcase_15 AC 243 ms
21,544 KB
testcase_16 AC 247 ms
21,572 KB
testcase_17 AC 245 ms
21,624 KB
testcase_18 AC 247 ms
21,680 KB
testcase_19 AC 243 ms
21,500 KB
testcase_20 AC 197 ms
21,496 KB
testcase_21 AC 203 ms
21,428 KB
testcase_22 AC 204 ms
21,356 KB
testcase_23 AC 206 ms
21,340 KB
testcase_24 AC 235 ms
21,616 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k,x,y = map(int, input().split())
a = list(map(int, input().split()))
num = [(a[i]+k-2)//k for i in range(n)]
num.sort()
s = [0] * (n+1)
for i in range(n):
    s[i+1] = num[i] + s[i]

ans = x*s[n]
ycnt = 0
for i in range(n):
    ycnt += max(0, num[i] - ycnt)
    ans = min(ans, y*ycnt + x*(s[n] - s[i] - ycnt*(n-i)))
print(ans)
0