結果

問題 No.68 よくある棒を切る問題 (2)
ユーザー 👑 colognecologne
提出日時 2022-01-25 11:35:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,366 ms / 5,000 ms
コード長 511 bytes
コンパイル時間 913 ms
コンパイル使用メモリ 86,948 KB
実行使用メモリ 179,564 KB
最終ジャッジ日時 2023-08-22 04:11:56
合計ジャッジ時間 32,857 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,366 ms
172,048 KB
testcase_01 AC 2,225 ms
171,900 KB
testcase_02 AC 2,340 ms
172,688 KB
testcase_03 AC 2,294 ms
179,356 KB
testcase_04 AC 2,319 ms
178,760 KB
testcase_05 AC 2,274 ms
178,784 KB
testcase_06 AC 2,183 ms
165,876 KB
testcase_07 AC 2,229 ms
168,900 KB
testcase_08 AC 2,085 ms
179,564 KB
testcase_09 AC 2,200 ms
176,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq
import sys


def input(): return sys.stdin.readline().rstrip()


def main():
    N = int(input())
    *L, = map(int, input().split())
    int(input())  # Q
    *K, = map(int, input().split())

    ans = [float('inf')]

    Q = [(-L[i], i, 1) for i in range(N)]
    heapq.heapify(Q)

    for i in range(max(K)):
        c, iv, kv = Q[0]
        ans.append(-c)
        heapq.heappushpop(Q, (-L[iv]/(kv+1), iv, kv+1))

    print(*[ans[k] for k in K], sep='\n')


if __name__ == '__main__':
    main()
0