結果
問題 | No.1071 ベホマラー |
ユーザー |
👑 ![]() |
提出日時 | 2020-06-05 22:14:05 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 88 ms / 2,000 ms |
コード長 | 313 bytes |
コンパイル時間 | 172 ms |
コンパイル使用メモリ | 82,460 KB |
実行使用メモリ | 94,636 KB |
最終ジャッジ日時 | 2024-12-17 15:48:58 |
合計ジャッジ時間 | 2,750 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 20 |
ソースコード
from math import floor,ceil N,K,X,Y=map(int,input().split()) A=list(map(int,input().split())) D=set() B=[] for i in range(N): x=ceil((A[i]-1)/K) B.append(x) B.sort() T=min(floor(Y/X),N) if T==N: print(sum(B)*X) else: P=B[N-1-T] S=P*Y for b in B: S+=max(0,b-P)*X print(S)