結果

問題 No.68 よくある棒を切る問題 (2)
ユーザー convexineqconvexineq
提出日時 2021-05-13 13:08:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,097 ms / 5,000 ms
コード長 405 bytes
コンパイル時間 156 ms
コンパイル使用メモリ 81,744 KB
実行使用メモリ 119,456 KB
最終ジャッジ日時 2023-10-25 07:07:49
合計ジャッジ時間 18,685 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,041 ms
112,348 KB
testcase_01 AC 1,047 ms
112,752 KB
testcase_02 AC 1,097 ms
112,564 KB
testcase_03 AC 953 ms
118,688 KB
testcase_04 AC 976 ms
117,380 KB
testcase_05 AC 996 ms
117,524 KB
testcase_06 AC 1,043 ms
112,680 KB
testcase_07 AC 1,070 ms
113,448 KB
testcase_08 AC 952 ms
119,456 KB
testcase_09 AC 939 ms
117,664 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import *
n = int(input())
*a, = map(int,input().split())
a.sort(reverse=1)
q = [(-ai*1.0,1) for ai in a]
cnt = 1
Q = int(input())
*k, = map(int,input().split())
ans = [0.0]*Q
order = sorted(range(Q),key = lambda i:k[i])
for i in order:
    for _ in range(k[i]-cnt):
        v,c = heappop(q)
        heappush(q,(v*c/(c+1),c+1))
    ans[i] = -q[0][0]
    cnt = k[i]
print("\n".join(map(str,ans)))
0