結果

問題 No.68 よくある棒を切る問題 (2)
ユーザー rkyiolklorkyiolklo
提出日時 2020-04-21 00:19:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 2,443 ms / 5,000 ms
コード長 435 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 51,976 KB
最終ジャッジ日時 2024-04-16 01:06:20
合計ジャッジ時間 32,969 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,438 ms
51,392 KB
testcase_01 AC 2,429 ms
51,936 KB
testcase_02 AC 2,443 ms
51,328 KB
testcase_03 AC 2,364 ms
51,976 KB
testcase_04 AC 2,357 ms
51,736 KB
testcase_05 AC 2,345 ms
51,768 KB
testcase_06 AC 2,232 ms
47,328 KB
testcase_07 AC 2,288 ms
48,912 KB
testcase_08 AC 2,095 ms
48,100 KB
testcase_09 AC 2,266 ms
49,876 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_])

solve()
0