結果

問題 No.68 よくある棒を切る問題 (2)
ユーザー titiatitia
提出日時 2021-12-26 03:27:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,478 ms / 5,000 ms
コード長 579 bytes
コンパイル時間 1,360 ms
コンパイル使用メモリ 81,608 KB
実行使用メモリ 125,284 KB
最終ジャッジ日時 2023-10-22 08:02:24
合計ジャッジ時間 22,989 ms
ジャッジサーバーID
(参考情報)
judge15 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,409 ms
112,936 KB
testcase_01 AC 1,352 ms
113,000 KB
testcase_02 AC 1,287 ms
108,552 KB
testcase_03 AC 1,455 ms
125,084 KB
testcase_04 AC 1,456 ms
124,792 KB
testcase_05 AC 1,478 ms
125,284 KB
testcase_06 AC 1,222 ms
108,780 KB
testcase_07 AC 1,225 ms
110,408 KB
testcase_08 AC 1,260 ms
118,704 KB
testcase_09 AC 1,272 ms
124,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# 解説 http://rsujskf.s602.xrea.com/?yukicoder_68
# を見ました。
# easyとは違う解法なのは驚き。特に、二分探索ではない方法があるというのは意外でした。

import sys
input = sys.stdin.readline
import heapq

N=int(input())
L=list(map(int,input().split()))
Q=int(input())
K=list(map(int,input().split()))

H=[]
for l in L:
    heapq.heappush(H,(-l,1))

ANS=[0]*(5*10**5+1)

for i in range(1,5*10**5+1):
    x,y=heapq.heappop(H)
    x=-x
    ANS[i]=x
    moto=x*y
    y+=1

    heapq.heappush(H,(-moto/y,y))

for k in K:
    print(ANS[k])
0