結果
| 問題 |
No.1071 ベホマラー
|
| コンテスト | |
| ユーザー |
kbys
|
| 提出日時 | 2020-06-23 04:05:10 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 622 bytes |
| コンパイル時間 | 141 ms |
| コンパイル使用メモリ | 82,284 KB |
| 実行使用メモリ | 95,136 KB |
| 最終ジャッジ日時 | 2024-07-03 19:05:46 |
| 合計ジャッジ時間 | 4,264 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 5 TLE * 1 -- * 14 |
ソースコード
import bisect
import sys
input=sys.stdin.readline
def main(args):
N, K, X, Y = map(int,input().split())
A = list(map(lambda x:-(-(int(x)-1)//K), input().split()))
A.sort()
ans = float('inf')
l = 0
behomara = 0
while True:
if behomara >= A[l]:
l = bisect.bisect_right(A,behomara)
#回復したい人数
res = N - l
if Y < res*X:
behomara += 1
else:
behoimi = sum(map(lambda x:x-behomara,A[l:]))
break
print(X*behoimi+Y*behomara)
if __name__ == '__main__':
main(sys.argv[1:])
kbys