結果
問題 | No.68 よくある棒を切る問題 (2) |
ユーザー |
![]() |
提出日時 | 2021-05-13 13:08:04 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,029 ms / 5,000 ms |
コード長 | 405 bytes |
コンパイル時間 | 256 ms |
コンパイル使用メモリ | 81,948 KB |
実行使用メモリ | 119,988 KB |
最終ジャッジ日時 | 2024-09-25 02:28:40 |
合計ジャッジ時間 | 17,194 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
from heapq import *n = int(input())*a, = map(int,input().split())a.sort(reverse=1)q = [(-ai*1.0,1) for ai in a]cnt = 1Q = int(input())*k, = map(int,input().split())ans = [0.0]*Qorder = sorted(range(Q),key = lambda i:k[i])for i in order:for _ in range(k[i]-cnt):v,c = heappop(q)heappush(q,(v*c/(c+1),c+1))ans[i] = -q[0][0]cnt = k[i]print("\n".join(map(str,ans)))