結果

問題 No.68 よくある棒を切る問題 (2)
ユーザー 👑 rin204rin204
提出日時 2022-09-29 19:24:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,302 ms / 5,000 ms
コード長 329 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 87,208 KB
実行使用メモリ 161,076 KB
最終ジャッジ日時 2023-08-24 05:01:27
合計ジャッジ時間 22,499 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,262 ms
152,444 KB
testcase_01 AC 1,302 ms
157,324 KB
testcase_02 AC 1,291 ms
156,568 KB
testcase_03 AC 1,287 ms
158,568 KB
testcase_04 AC 1,302 ms
155,652 KB
testcase_05 AC 1,302 ms
161,076 KB
testcase_06 AC 1,217 ms
148,464 KB
testcase_07 AC 1,243 ms
150,576 KB
testcase_08 AC 1,221 ms
159,268 KB
testcase_09 AC 1,224 ms
160,716 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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