結果

問題 No.68 よくある棒を切る問題 (2)
コンテスト
ユーザー rin204
提出日時 2022-09-29 19:24:52
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 971 ms / 5,000 ms
コード長 329 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 134 ms
コンパイル使用メモリ 85,760 KB
実行使用メモリ 162,580 KB
最終ジャッジ日時 2026-05-28 22:27:23
合計ジャッジ時間 16,596 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from heapq import *

n = int(input())
L = list(map(int, input().split()))
hq = [(-l, 1) for l in L]
heapify(hq)
ans = [-1]
for _ in range(500000):
    l, c = heappop(hq)
    l *= -1
    ans.append(l)
    heappush(hq, (-l * c / (c + 1), c + 1))

Q = int(input())
K = list(map(int, input().split()))
for k in K:
    print(ans[k])

0