結果

問題 No.2453 Seat Allocation
ユーザー noriocnorioc
提出日時 2023-09-06 01:44:19
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 491 bytes
コンパイル時間 744 ms
コンパイル使用メモリ 87,280 KB
実行使用メモリ 133,680 KB
最終ジャッジ日時 2023-09-06 01:44:33
合計ジャッジ時間 12,526 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 237 ms
89,872 KB
testcase_01 AC 268 ms
89,388 KB
testcase_02 AC 247 ms
89,524 KB
testcase_03 AC 246 ms
89,216 KB
testcase_04 AC 240 ms
89,532 KB
testcase_05 AC 1,863 ms
133,680 KB
testcase_06 AC 789 ms
106,200 KB
testcase_07 AC 718 ms
112,284 KB
testcase_08 AC 541 ms
94,456 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappush, heappop
from fractions import Fraction

N, M = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

B.sort()

q = []  # (score, a-index, b-index)
for i, a in enumerate(A):
    heappush(q, (-Fraction(a, B[0]), i, 0))

for _ in range(M):
    _, a_index, b_index = heappop(q)
    print(a_index + 1)
    if b_index+1 < M:
        frac = -Fraction(A[a_index], B[b_index+1])
        heappush(q, (frac, a_index, b_index+1))
0