結果

問題 No.68 よくある棒を切る問題 (2)
ユーザー aaaaaaaaaa2230
提出日時 2022-01-02 12:01:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,301 ms / 5,000 ms
コード長 436 bytes
コンパイル時間 169 ms
コンパイル使用メモリ 82,064 KB
実行使用メモリ 126,640 KB
最終ジャッジ日時 2024-10-11 09:48:06
合計ジャッジ時間 20,086 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

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