結果
| 問題 |
No.1071 ベホマラー
|
| コンテスト | |
| ユーザー |
ohana
|
| 提出日時 | 2023-11-17 16:48:10 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 91 ms / 2,000 ms |
| コード長 | 296 bytes |
| コンパイル時間 | 875 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 87,680 KB |
| 最終ジャッジ日時 | 2024-09-26 05:26:45 |
| 合計ジャッジ時間 | 3,606 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 20 |
ソースコード
n, k, x, y = map(int, input().split())
A = list(map(int, input().split()))
th = int(-(-y // x))
B = [-(-(a - 1) // k) for a in A]
B.sort(reverse=True)
if th > n:
print(sum(B))
else:
Y_num = B[th - 1]
ans = Y_num * y
ans += sum([max(0, b - Y_num) * x for b in B])
print(ans)
ohana