結果

問題 No.1071 ベホマラー
ユーザー c-yan
提出日時 2020-06-05 21:46:44
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 274 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 21,804 KB
最終ジャッジ日時 2024-12-17 14:10:19
合計ジャッジ時間 2,895 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 3 RE * 1
other AC * 6 WA * 12 RE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import ceil

N, K, X, Y = map(int, input().split())
A = list(map(int, input().split()))

B = [(a + K - 1) // K for a in A]
B.sort(reverse=True)

if Y <= X:
    print(Y * B[0])
    exit()
t = ceil(Y / X) - 1
print(Y * B[t] + X * sum(B[i] - B[t] for i in range(t)))
0