結果

問題 No.2453 Seat Allocation
ユーザー hiro1729
提出日時 2023-09-02 13:38:02
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 362 bytes
コンパイル時間 388 ms
コンパイル使用メモリ 81,972 KB
実行使用メモリ 153,776 KB
最終ジャッジ日時 2024-06-11 20:16:36
合計ジャッジ時間 13,252 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18 TLE * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

from decimal import Decimal
from heapq import *
n, m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
d = [1] * n
h = [(-Decimal(x) / b[0], i) for i, x in enumerate(a)]
heapify(h)
while m:
	_, k = heappop(h)
	print(k + 1)
	m -= 1
	j = d[k]
	d[k] = j + 1
	if j < len(b):
		heappush(h, (-Decimal(a[k]) / b[j], k))
0