結果
| 問題 | No.68 よくある棒を切る問題 (2) | 
| コンテスト | |
| ユーザー |  maspy | 
| 提出日時 | 2020-03-24 15:32:55 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2,316 ms / 5,000 ms | 
| コード長 | 522 bytes | 
| コンパイル時間 | 372 ms | 
| コンパイル使用メモリ | 12,800 KB | 
| 実行使用メモリ | 53,684 KB | 
| 最終ジャッジ日時 | 2024-12-31 15:07:56 | 
| 合計ジャッジ時間 | 32,388 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 | 
ソースコード
#!/usr/bin/ python3.8
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from heapq import heapify, heapreplace
N = int(readline())
q = [(-int(x), 1) for x in readline().split()]
Q = int(readline())
K = tuple(map(int, readline().split()))
U = 5 * 10**5
answer = [0] * (U + 1)
heapify(q)
for i in range(1, U + 1):
    x, j = q[0]
    answer[i] = -x
    x *= j
    j += 1
    x /= j
    heapreplace(q, (x, j))
print('\n'.join(str(answer[k]) for k in K))
            
            
            
        