結果

問題 No.2453 Seat Allocation
ユーザー titia
提出日時 2023-09-01 23:09:15
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 428 bytes
コンパイル時間 403 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 32,504 KB
最終ジャッジ日時 2024-06-11 17:52:59
合計ジャッジ時間 8,707 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

from heapq import heappop,heappush

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

for i in range(N):
    A[i]*=10**9


H=[]
for i in range(N):
    H.append((-A[i]/B[0],i+1,0))

H.sort()
count=0

while H and count<M:
    count+=1
    x,ind,c=heappop(H)

    print(ind)

    if c<M-1:
        c+=1
        heappush(H,(-A[ind-1]/B[c],ind,c))
0