結果

問題 No.2453 Seat Allocation
ユーザー detteiuu
提出日時 2024-12-22 06:49:52
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 441 bytes
コンパイル時間 463 ms
コンパイル使用メモリ 82,588 KB
実行使用メモリ 222,136 KB
最終ジャッジ日時 2024-12-22 06:50:24
合計ジャッジ時間 32,203 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16 TLE * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

from fractions import Fraction
from heapq import heappush, heappop

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

que = []
for i in range(N):
    heappush(que, (-Fraction(A[i], B[0]), i, 0))

for _ in range(M):
    f, i, j = heappop(que)
    f = -f
    print(i+1)
    if j+1 < M:
        heappush(que, (-Fraction(A[i], B[j+1]), i, j+1))
    else:
        heappush(que, (0, i, j+1))
0