結果

問題 No.2453 Seat Allocation
ユーザー KudeKude
提出日時 2023-09-01 21:47:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,430 ms / 2,000 ms
コード長 382 bytes
コンパイル時間 1,642 ms
コンパイル使用メモリ 86,800 KB
実行使用メモリ 126,816 KB
最終ジャッジ日時 2023-09-07 15:34:54
合計ジャッジ時間 19,640 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 214 ms
89,772 KB
testcase_01 AC 214 ms
89,772 KB
testcase_02 AC 216 ms
89,532 KB
testcase_03 AC 216 ms
89,656 KB
testcase_04 AC 216 ms
89,904 KB
testcase_05 AC 882 ms
126,816 KB
testcase_06 AC 541 ms
106,284 KB
testcase_07 AC 471 ms
111,376 KB
testcase_08 AC 488 ms
95,448 KB
testcase_09 AC 1,430 ms
125,428 KB
testcase_10 AC 1,341 ms
125,408 KB
testcase_11 AC 1,339 ms
125,988 KB
testcase_12 AC 631 ms
104,984 KB
testcase_13 AC 639 ms
106,688 KB
testcase_14 AC 422 ms
105,048 KB
testcase_15 AC 776 ms
106,104 KB
testcase_16 AC 665 ms
105,388 KB
testcase_17 AC 218 ms
89,712 KB
testcase_18 AC 1,121 ms
116,892 KB
testcase_19 AC 1,217 ms
119,832 KB
testcase_20 AC 688 ms
104,968 KB
testcase_21 AC 811 ms
105,120 KB
testcase_22 AC 1,043 ms
109,820 KB
testcase_23 AC 214 ms
89,808 KB
testcase_24 AC 216 ms
89,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappushpop, heapify
from fractions import Fraction
n, m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
b.append(1)
q = [(-Fraction(a[i], b[0]), i) for i in range(n)]
now = [0] * n
heapify(q)
for _ in range(m):
    _, i = q[0]
    print(i + 1)
    now[i] += 1
    heappushpop(q, (-Fraction(a[i], b[now[i]]), i))
0