結果

問題 No.68 よくある棒を切る問題 (2)
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-01-02 11:57:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,361 ms / 5,000 ms
コード長 399 bytes
コンパイル時間 603 ms
コンパイル使用メモリ 82,476 KB
実行使用メモリ 145,560 KB
最終ジャッジ日時 2024-04-19 17:37:38
合計ジャッジ時間 31,902 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,339 ms
134,172 KB
testcase_01 AC 2,281 ms
135,256 KB
testcase_02 AC 2,361 ms
135,068 KB
testcase_03 AC 2,266 ms
145,332 KB
testcase_04 AC 2,257 ms
145,252 KB
testcase_05 AC 2,262 ms
145,560 KB
testcase_06 AC 2,233 ms
127,708 KB
testcase_07 AC 2,328 ms
131,196 KB
testcase_08 AC 2,012 ms
136,040 KB
testcase_09 AC 2,118 ms
141,476 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappush, heappop

n = int(input())
L = list(map(int,input().split()))
Q = int(input())
K = list(map(int,input().split()))
M = 5*10**5+5

size = [1]*n

h = []
for i,l in enumerate(L):
    heappush(h,[-l,i])

ans = [0]*M
for i in range(1,M):
    x,ind = heappop(h)
    x *= -1
    ans[i] = x
    size[ind] += 1
    heappush(h,[-L[ind]/size[ind],ind])


for k in K:
    print(ans[k])
0