結果

問題 No.2453 Seat Allocation
ユーザー hiro1729hiro1729
提出日時 2023-09-02 13:37:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 931 ms / 2,000 ms
コード長 362 bytes
コンパイル時間 82 ms
コンパイル使用メモリ 10,908 KB
実行使用メモリ 39,564 KB
最終ジャッジ日時 2023-09-07 15:38:33
合計ジャッジ時間 9,794 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 21 ms
8,996 KB
testcase_01 AC 21 ms
9,112 KB
testcase_02 AC 20 ms
8,964 KB
testcase_03 AC 21 ms
9,048 KB
testcase_04 AC 22 ms
9,148 KB
testcase_05 AC 605 ms
39,328 KB
testcase_06 AC 311 ms
19,688 KB
testcase_07 AC 190 ms
32,244 KB
testcase_08 AC 77 ms
11,716 KB
testcase_09 AC 871 ms
39,564 KB
testcase_10 AC 931 ms
38,976 KB
testcase_11 AC 852 ms
39,092 KB
testcase_12 AC 298 ms
20,048 KB
testcase_13 AC 346 ms
19,616 KB
testcase_14 AC 289 ms
20,136 KB
testcase_15 AC 393 ms
19,784 KB
testcase_16 AC 342 ms
20,384 KB
testcase_17 AC 21 ms
8,972 KB
testcase_18 AC 579 ms
23,324 KB
testcase_19 AC 692 ms
32,240 KB
testcase_20 AC 263 ms
19,172 KB
testcase_21 AC 344 ms
16,688 KB
testcase_22 AC 538 ms
19,912 KB
testcase_23 AC 21 ms
8,980 KB
testcase_24 AC 21 ms
8,980 KB
権限があれば一括ダウンロードができます

ソースコード

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