結果

問題 No.68 よくある棒を切る問題 (2)
ユーザー 37zigen37zigen
提出日時 2020-07-26 01:29:52
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,984 ms / 5,000 ms
コード長 331 bytes
コンパイル時間 384 ms
コンパイル使用メモリ 10,964 KB
実行使用メモリ 52,780 KB
最終ジャッジ日時 2023-09-10 02:30:18
合計ジャッジ時間 28,502 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,922 ms
52,160 KB
testcase_01 AC 1,927 ms
52,780 KB
testcase_02 AC 1,984 ms
52,100 KB
testcase_03 AC 1,958 ms
50,960 KB
testcase_04 AC 1,908 ms
51,052 KB
testcase_05 AC 1,918 ms
50,940 KB
testcase_06 AC 1,756 ms
50,116 KB
testcase_07 AC 1,889 ms
51,800 KB
testcase_08 AC 1,731 ms
49,292 KB
testcase_09 AC 1,807 ms
50,176 KB
権限があれば一括ダウンロードができます

ソースコード

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