結果

問題 No.1071 ベホマラー
ユーザー rythem00359
提出日時 2020-08-25 18:07:16
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 230 ms / 2,000 ms
コード長 249 bytes
コンパイル時間 369 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 21,976 KB
最終ジャッジ日時 2024-11-06 11:37:05
合計ジャッジ時間 4,393 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import ceil
n,k,x,y=map(int,input().split())
a=sorted([*map(lambda x:ceil((int(x)-1)/k),input().split())])
ans,m,b,c=0,0,n,0
while b>0:
    m=a[-b]-c
    ans+=y*m if y<b*x else b*x*m
    c=a[-b]
    while a[-b]-c<=0 and b>0:b-=1
print(ans)
0