結果

問題 No.2453 Seat Allocation
ユーザー aaaaaaaaaa2230
提出日時 2023-09-01 23:09:56
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 433 bytes
コンパイル時間 552 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 109,020 KB
最終ジャッジ日時 2025-01-03 11:18:49
合計ジャッジ時間 9,234 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17 WA * 5
権限があれば一括ダウンロードができます

ソースコード

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**10

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