結果
| 問題 | No.68 よくある棒を切る問題 (2) | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2022-01-02 11:57:00 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 3,344 ms / 5,000 ms | 
| コード長 | 399 bytes | 
| コンパイル時間 | 1,258 ms | 
| コンパイル使用メモリ | 81,556 KB | 
| 実行使用メモリ | 144,976 KB | 
| 最終ジャッジ日時 | 2024-10-11 09:43:36 | 
| 合計ジャッジ時間 | 43,340 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 | 
ソースコード
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])
            
            
            
        