結果

問題 No.68 よくある棒を切る問題 (2)
ユーザー KudeKude
提出日時 2021-01-25 02:01:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,505 ms / 5,000 ms
コード長 387 bytes
コンパイル時間 444 ms
コンパイル使用メモリ 87,292 KB
実行使用メモリ 132,612 KB
最終ジャッジ日時 2023-09-02 13:35:53
合計ジャッジ時間 23,615 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,402 ms
126,428 KB
testcase_01 AC 1,392 ms
127,104 KB
testcase_02 AC 1,378 ms
125,636 KB
testcase_03 AC 1,505 ms
132,612 KB
testcase_04 AC 1,433 ms
132,392 KB
testcase_05 AC 1,415 ms
130,880 KB
testcase_06 AC 1,300 ms
119,700 KB
testcase_07 AC 1,355 ms
124,172 KB
testcase_08 AC 1,403 ms
131,484 KB
testcase_09 AC 1,369 ms
132,044 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappop, heappush, heapify

n = int(input())
l = list(map(int, input().split()))
d = [0] * (5 * 10 ** 5 + 1)
cnt = [0] * n
q = [(-l[i], i) for i in range(n)]
heapify(q)
for c in range(1, 5 * 10 ** 5 + 1):
    x, i = heappop(q)
    x = -x
    d[c] = x
    cnt[i] += 1
    heappush(q, (-l[i] / (cnt[i] + 1), i))
input()
for k in map(int, input().split()):
    print(d[k])
0