結果

問題 No.68 よくある棒を切る問題 (2)
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-01-02 11:59:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,509 ms / 5,000 ms
コード長 436 bytes
コンパイル時間 343 ms
コンパイル使用メモリ 82,628 KB
実行使用メモリ 145,004 KB
最終ジャッジ日時 2024-04-19 17:40:16
合計ジャッジ時間 32,205 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,509 ms
133,624 KB
testcase_01 AC 2,477 ms
134,784 KB
testcase_02 AC 2,460 ms
134,972 KB
testcase_03 AC 2,360 ms
145,004 KB
testcase_04 AC 2,407 ms
144,864 KB
testcase_05 AC 2,329 ms
144,776 KB
testcase_06 AC 2,277 ms
127,876 KB
testcase_07 AC 2,375 ms
131,312 KB
testcase_08 AC 2,209 ms
135,876 KB
testcase_09 AC 2,308 ms
141,196 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappush, heappop
import sys
input = sys.stdin.readline
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