結果

問題 No.2453 Seat Allocation
ユーザー ゼット
提出日時 2023-09-01 22:07:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 502 ms / 2,000 ms
コード長 538 bytes
コンパイル時間 168 ms
コンパイル使用メモリ 82,484 KB
実行使用メモリ 113,188 KB
最終ジャッジ日時 2025-06-20 01:44:39
合計ジャッジ時間 6,307 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
from heapq import heappush,heappop
S=[]
T={}
for i in range(N):
  x=A[i]*(10**20)
  x//=B[0]
  score=x*10**6+(10**5-i)
  heappush(S,-score)
count=0
while True:
  count+=1
  score=heappop(S)
  score=-score
  ans=score%(10**6)
  ans=10**5-ans
  print(ans+1)
  if not ans in T:
    T[ans]=1
  else:
    T[ans]+=1
  if count==M:
    break
  else:
    n=T[ans]
    x=A[ans]*10**20
    x//=B[n]
    score=x*10**6+10**5-ans
    heappush(S,-score)

  
0