結果

問題 No.68 よくある棒を切る問題 (2)
ユーザー pessimist
提出日時 2025-06-17 17:27:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,029 ms / 5,000 ms
コード長 432 bytes
コンパイル時間 408 ms
コンパイル使用メモリ 82,288 KB
実行使用メモリ 115,304 KB
最終ジャッジ日時 2025-06-17 17:27:27
合計ジャッジ時間 17,270 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read=sys.stdin.buffer.read
readline=sys.stdin.buffer.readline

N=int(readline())
L=list(map(int,readline().split()))
Q,*K=map(int,read().split())

from heapq import heapify, heappushpop
heap=[(-l, -1.) for l in L]
heapify(heap)
NMAX=5*10**5 + 10
ans=[0]*NMAX
for i in range(NMAX):
    l,cnt=heap[0]
    l,cnt=-l,-cnt
    ans[i]=l
    heappushpop(heap, (-(l*cnt/(cnt+1)), -(cnt+1)))
print(*[ans[k-1] for k in K], sep='\n')
0