結果

問題 No.2453 Seat Allocation
ユーザー ntudantuda
提出日時 2023-09-02 10:37:23
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 485 bytes
コンパイル時間 1,265 ms
コンパイル使用メモリ 87,180 KB
実行使用メモリ 107,156 KB
最終ジャッジ日時 2023-09-02 10:37:33
合計ジャッジ時間 8,269 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,468 KB
testcase_01 AC 74 ms
71,168 KB
testcase_02 AC 76 ms
71,368 KB
testcase_03 RE -
testcase_04 AC 75 ms
71,636 KB
testcase_05 AC 278 ms
107,156 KB
testcase_06 AC 158 ms
91,632 KB
testcase_07 RE -
testcase_08 AC 137 ms
79,388 KB
testcase_09 AC 391 ms
97,452 KB
testcase_10 AC 410 ms
97,100 KB
testcase_11 AC 376 ms
97,672 KB
testcase_12 AC 230 ms
91,388 KB
testcase_13 AC 245 ms
91,596 KB
testcase_14 AC 139 ms
91,016 KB
testcase_15 AC 282 ms
91,848 KB
testcase_16 AC 278 ms
90,888 KB
testcase_17 AC 76 ms
71,496 KB
testcase_18 AC 321 ms
92,912 KB
testcase_19 AC 334 ms
97,304 KB
testcase_20 AC 204 ms
85,656 KB
testcase_21 AC 222 ms
86,420 KB
testcase_22 AC 278 ms
90,700 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

'''
Yuki 2453
Seat Allocation

Ai/Bj (i = 1..N, j = 1..M)
を降り順にソートしたときのk番目のiを答える。
'''
from heapq import *

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

X = [1] * N  # それぞれの政党、次何番目か
q = []
for i, a in enumerate(A):
    heappush(q, (-a / B[0], i))
for k in range(M):
    _, p = heappop(q)
    print(p + 1)
    heappush(q, (-A[p] / B[X[p]], p))
    X[p] += 1
0