結果

問題 No.1071 ベホマラー
ユーザー nephrologist
提出日時 2020-06-08 19:17:03
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 153 ms / 2,000 ms
コード長 348 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 21,680 KB
最終ジャッジ日時 2024-12-26 03:54:34
合計ジャッジ時間 3,797 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k, x, y = map(int, input().split())
A = list(map(int, input().split()))
kouho = []
for a in A:
    kouho.append((a - 1 + k - 1) // k)
kouho.sort()
lim = y // x
behomara = 0
behoimi = 0
if n - lim - 1 >= 0:
    behomara = kouho[n - lim - 1]
for i in range(max(n - lim, 0), n):
    behoimi += kouho[i] - behomara
print(x * behoimi + y * behomara)
0