結果

問題 No.2453 Seat Allocation
ユーザー lloyzlloyz
提出日時 2023-09-04 01:11:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 367 bytes
コンパイル時間 121 ms
コンパイル使用メモリ 82,392 KB
実行使用メモリ 108,724 KB
最終ジャッジ日時 2024-06-22 01:17:52
合計ジャッジ時間 6,578 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappop, heappush

n, m = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

H = []
for i in range(n):
    heappush(H, (-A[i] / B[0], i, 0))
for _ in range(m):
    _, ans, idx = heappop(H)
    print(ans + 1)
    idx += 1
    if idx == m:
        continue
    heappush(H, (-A[ans] / B[idx], ans, idx))
0