結果

問題 No.68 よくある棒を切る問題 (2)
ユーザー tnodinotnodino
提出日時 2022-03-06 15:43:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 2,190 ms / 5,000 ms
コード長 422 bytes
コンパイル時間 85 ms
コンパイル使用メモリ 10,952 KB
実行使用メモリ 57,228 KB
最終ジャッジ日時 2023-09-28 06:52:31
合計ジャッジ時間 30,021 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,032 ms
57,136 KB
testcase_01 AC 2,190 ms
57,228 KB
testcase_02 AC 1,987 ms
57,124 KB
testcase_03 AC 2,140 ms
57,132 KB
testcase_04 AC 2,156 ms
57,016 KB
testcase_05 AC 2,104 ms
57,096 KB
testcase_06 AC 1,847 ms
53,484 KB
testcase_07 AC 2,085 ms
55,308 KB
testcase_08 AC 1,793 ms
53,036 KB
testcase_09 AC 1,862 ms
54,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappush, heappop
N = int(input())
L = list(map(int,input().split()))
heap = []
for i in range(N):
    heappush(heap, (-L[i], i))
M = 500000
ans = [0] * (M+1)
cnt = [0] * N
for i in range(1,M+1):
    A,P = heappop(heap)
    A *= -1
    ans[i] = A
    cnt[P] += 1
    heappush(heap, (-(L[P] / (cnt[P] + 1.0)), P))
Q = int(input())
K = list(map(int,input().split()))
for i in range(Q):
    print(ans[K[i]])
0