結果

問題 No.2453 Seat Allocation
ユーザー ゼットゼット
提出日時 2023-09-01 22:07:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 567 ms / 2,000 ms
コード長 538 bytes
コンパイル時間 250 ms
コンパイル使用メモリ 86,884 KB
実行使用メモリ 115,192 KB
最終ジャッジ日時 2023-09-07 15:35:26
合計ジャッジ時間 7,730 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,300 KB
testcase_01 AC 71 ms
71,376 KB
testcase_02 AC 72 ms
71,404 KB
testcase_03 AC 73 ms
71,372 KB
testcase_04 AC 73 ms
71,408 KB
testcase_05 AC 345 ms
114,748 KB
testcase_06 AC 186 ms
91,508 KB
testcase_07 AC 168 ms
91,624 KB
testcase_08 AC 129 ms
78,948 KB
testcase_09 AC 567 ms
111,428 KB
testcase_10 AC 537 ms
115,192 KB
testcase_11 AC 552 ms
113,936 KB
testcase_12 AC 197 ms
91,440 KB
testcase_13 AC 195 ms
91,504 KB
testcase_14 AC 164 ms
90,852 KB
testcase_15 AC 256 ms
91,464 KB
testcase_16 AC 215 ms
90,892 KB
testcase_17 AC 74 ms
71,444 KB
testcase_18 AC 422 ms
95,336 KB
testcase_19 AC 473 ms
105,740 KB
testcase_20 AC 267 ms
87,100 KB
testcase_21 AC 276 ms
86,636 KB
testcase_22 AC 384 ms
92,500 KB
testcase_23 AC 68 ms
71,484 KB
testcase_24 AC 70 ms
71,372 KB
権限があれば一括ダウンロードができます

ソースコード

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