結果
問題 | No.68 よくある棒を切る問題 (2) |
ユーザー |
|
提出日時 | 2022-01-02 11:59:12 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 2,922 ms / 5,000 ms |
コード長 | 436 bytes |
コンパイル時間 | 175 ms |
コンパイル使用メモリ | 82,116 KB |
実行使用メモリ | 145,632 KB |
最終ジャッジ日時 | 2024-10-11 09:46:51 |
合計ジャッジ時間 | 37,808 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
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])