結果

問題 No.68 よくある棒を切る問題 (2)
ユーザー 37zigen
提出日時 2020-07-26 01:29:52
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 2,034 ms / 5,000 ms
コード長 331 bytes
コンパイル時間 207 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 53,924 KB
最終ジャッジ日時 2024-06-27 18:40:08
合計ジャッジ時間 27,903 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heapify, heapreplace
n=int(input())
q=[(-int(x),1) for x in input().split()]
Q=int(input())
K=[int(x) for x in input().split()]
U=5 * 10**5
ans=[-1]*(U+1)

heapify(q)

for i in range(1,U+1):
    x, j=q[0]
    ans[i]=-x
    x*=j
    j+=1
    x/=j
    heapreplace(q, (x,j))

print("\n".join(str(ans[i]) for i in K))
0