結果

問題 No.68 よくある棒を切る問題 (2)
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-01-02 12:01:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,104 ms / 5,000 ms
コード長 436 bytes
コンパイル時間 343 ms
コンパイル使用メモリ 82,572 KB
実行使用メモリ 127,136 KB
最終ジャッジ日時 2024-04-19 17:41:39
合計ジャッジ時間 17,548 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,089 ms
114,420 KB
testcase_01 AC 1,084 ms
114,184 KB
testcase_02 AC 1,095 ms
114,560 KB
testcase_03 AC 1,085 ms
126,628 KB
testcase_04 AC 1,095 ms
126,832 KB
testcase_05 AC 1,104 ms
127,136 KB
testcase_06 AC 1,041 ms
109,964 KB
testcase_07 AC 1,061 ms
111,608 KB
testcase_08 AC 1,019 ms
119,880 KB
testcase_09 AC 1,076 ms
125,004 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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])
0