結果

問題 No.68 よくある棒を切る問題 (2)
ユーザー しらっ亭しらっ亭
提出日時 2015-08-03 12:08:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,758 ms / 5,000 ms
コード長 505 bytes
コンパイル時間 273 ms
コンパイル使用メモリ 87,196 KB
実行使用メモリ 143,900 KB
最終ジャッジ日時 2023-09-25 00:49:13
合計ジャッジ時間 36,993 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,758 ms
133,708 KB
testcase_01 AC 2,689 ms
132,608 KB
testcase_02 AC 2,729 ms
132,948 KB
testcase_03 AC 2,724 ms
143,900 KB
testcase_04 AC 2,706 ms
143,384 KB
testcase_05 AC 2,748 ms
143,728 KB
testcase_06 AC 2,517 ms
126,528 KB
testcase_07 AC 2,706 ms
130,016 KB
testcase_08 AC 2,482 ms
140,984 KB
testcase_09 AC 2,587 ms
141,740 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq


def solve():
    N = int(input())
    L = list(map(int, input().split()))
    Q = int(input())
    K = list(map(int, input().split()))

    h = []

    for i in range(N):
        heapq.heappush(h, (-L[i], 1, i))

    MAX = 500001

    A = [0.0] * MAX
    for j in range(1, MAX):
        l, n, i = heapq.heappop(h)
        A[j] = -l
        heapq.heappush(h, (-L[i] / (n + 1), n + 1, i))

    for k in K:
        print(A[k])


def main():
    solve()


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