結果
問題 | No.1071 ベホマラー |
ユーザー |
![]() |
提出日時 | 2020-06-06 01:49:01 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 82 ms / 2,000 ms |
コード長 | 376 bytes |
コンパイル時間 | 1,088 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 85,120 KB |
最終ジャッジ日時 | 2024-12-17 23:16:06 |
合計ジャッジ時間 | 3,444 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 20 |
ソースコード
n,k,x,y = map(int,input().split()) a = list(map(int,input().split())) a.sort(reverse=True) # ベホイミのほうが効率が良い最大人数 upper = y//x if(upper < n): bhm = 1 + (a[upper]-1-1)//k else: upper = n bhm = 0 ans = y*bhm for i in a[:upper]: remain = i - k*bhm if(remain<=0): continue ans += (1+(remain-1-1)//k) * x print(ans)