結果

問題 No.68 よくある棒を切る問題 (2)
ユーザー しらっ亭しらっ亭
提出日時 2015-08-03 12:12:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,785 ms / 5,000 ms
コード長 496 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 87,068 KB
実行使用メモリ 144,060 KB
最終ジャッジ日時 2023-09-25 00:51:27
合計ジャッジ時間 36,343 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,756 ms
132,684 KB
testcase_01 AC 2,785 ms
132,120 KB
testcase_02 AC 2,774 ms
132,360 KB
testcase_03 AC 2,599 ms
144,060 KB
testcase_04 AC 2,683 ms
143,236 KB
testcase_05 AC 2,679 ms
143,624 KB
testcase_06 AC 2,546 ms
126,268 KB
testcase_07 AC 2,584 ms
129,636 KB
testcase_08 AC 2,413 ms
140,592 KB
testcase_09 AC 2,524 ms
141,632 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 = h[0]
        A[j] = -l
        heapq.heapreplace(h, (-L[i] / (n + 1), n + 1, i))

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


def main():
    solve()


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