結果

問題 No.68 よくある棒を切る問題 (2)
ユーザー しらっ亭しらっ亭
提出日時 2015-08-03 12:15:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,693 ms / 5,000 ms
コード長 496 bytes
コンパイル時間 70 ms
コンパイル使用メモリ 10,856 KB
実行使用メモリ 49,284 KB
最終ジャッジ日時 2023-09-25 00:52:05
合計ジャッジ時間 24,240 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,633 ms
48,732 KB
testcase_01 AC 1,609 ms
49,204 KB
testcase_02 AC 1,639 ms
48,720 KB
testcase_03 AC 1,579 ms
49,284 KB
testcase_04 AC 1,693 ms
49,152 KB
testcase_05 AC 1,619 ms
49,156 KB
testcase_06 AC 1,592 ms
45,616 KB
testcase_07 AC 1,539 ms
46,616 KB
testcase_08 AC 1,407 ms
45,852 KB
testcase_09 AC 1,583 ms
47,284 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