結果

問題 No.2453 Seat Allocation
ユーザー ntudantuda
提出日時 2023-09-09 14:14:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 567 ms / 2,000 ms
コード長 532 bytes
コンパイル時間 1,967 ms
コンパイル使用メモリ 86,804 KB
実行使用メモリ 111,288 KB
最終ジャッジ日時 2023-09-09 14:14:49
合計ジャッジ時間 10,172 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,308 KB
testcase_01 AC 82 ms
71,348 KB
testcase_02 AC 75 ms
71,268 KB
testcase_03 AC 74 ms
71,292 KB
testcase_04 AC 75 ms
71,300 KB
testcase_05 AC 362 ms
111,088 KB
testcase_06 AC 190 ms
91,496 KB
testcase_07 AC 174 ms
95,332 KB
testcase_08 AC 153 ms
79,508 KB
testcase_09 AC 561 ms
111,288 KB
testcase_10 AC 553 ms
111,124 KB
testcase_11 AC 567 ms
111,168 KB
testcase_12 AC 241 ms
91,004 KB
testcase_13 AC 259 ms
91,636 KB
testcase_14 AC 182 ms
90,824 KB
testcase_15 AC 294 ms
91,492 KB
testcase_16 AC 385 ms
90,908 KB
testcase_17 AC 78 ms
71,312 KB
testcase_18 AC 434 ms
101,980 KB
testcase_19 AC 480 ms
107,036 KB
testcase_20 AC 246 ms
88,184 KB
testcase_21 AC 271 ms
86,596 KB
testcase_22 AC 357 ms
96,540 KB
testcase_23 AC 78 ms
71,212 KB
testcase_24 AC 76 ms
71,292 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()))
F = 10 ** 20

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