結果

問題 No.68 よくある棒を切る問題 (2)
ユーザー しらっ亭
提出日時 2015-08-03 12:08:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,681 ms / 5,000 ms
コード長 505 bytes
コンパイル時間 154 ms
コンパイル使用メモリ 82,164 KB
実行使用メモリ 142,952 KB
最終ジャッジ日時 2024-07-18 01:02:57
合計ジャッジ時間 35,064 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

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