結果

問題 No.2453 Seat Allocation
ユーザー aaaaaaaaaa2230
提出日時 2023-09-01 23:10:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 909 ms / 2,000 ms
コード長 433 bytes
コンパイル時間 602 ms
コンパイル使用メモリ 82,316 KB
実行使用メモリ 127,508 KB
最終ジャッジ日時 2025-06-20 01:47:11
合計ジャッジ時間 9,713 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappop,heappush
n,m = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))


inf = 10**20

h = []
num = [0]*n

for i in range(n):
    heappush(h,[-inf*A[i]//B[0],i])

ans = []
for _ in range(m):
    x,ind = heappop(h)
    ans.append(ind+1)

    num[ind] += 1
    if num[ind] >= m:
        continue
    heappush(h,[-inf*A[ind]//B[num[ind]],ind])

for i in ans:
    print(i)
0