結果
問題 | No.1071 ベホマラー |
ユーザー |
![]() |
提出日時 | 2020-06-05 21:31:32 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 82 ms / 2,000 ms |
コード長 | 409 bytes |
コンパイル時間 | 151 ms |
コンパイル使用メモリ | 82,780 KB |
実行使用メモリ | 87,612 KB |
最終ジャッジ日時 | 2024-12-17 13:32:04 |
合計ジャッジ時間 | 2,661 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 20 |
ソースコード
n, k, x, y = map(int, input().split())a = list(map(int, input().split()))for i in range(n):a[i] -= 1# 残りがcnt人以上ならベホマラーがお得cnt = -((-y) // x)a = sorted(a)ind = n - cntif ind < 0:cnt_y = 0ans = 0else:cnt_y = -((-a[ind]) // k)ans = cnt_y * yfor i in range(n):a[i] -= cnt_y * kif a[i] > 0:ans += -((-a[i]) // k) * xprint(ans)