結果

問題 No.2453 Seat Allocation
ユーザー 👑 timitimi
提出日時 2023-09-01 22:35:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,033 ms / 2,000 ms
コード長 435 bytes
コンパイル時間 359 ms
コンパイル使用メモリ 10,908 KB
実行使用メモリ 39,552 KB
最終ジャッジ日時 2023-09-07 15:36:30
合計ジャッジ時間 11,076 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
9,216 KB
testcase_01 AC 21 ms
9,056 KB
testcase_02 AC 22 ms
9,216 KB
testcase_03 AC 20 ms
9,064 KB
testcase_04 AC 22 ms
9,076 KB
testcase_05 AC 732 ms
39,552 KB
testcase_06 AC 383 ms
18,888 KB
testcase_07 AC 286 ms
31,676 KB
testcase_08 AC 92 ms
11,844 KB
testcase_09 AC 1,026 ms
38,352 KB
testcase_10 AC 1,033 ms
38,312 KB
testcase_11 AC 1,029 ms
38,456 KB
testcase_12 AC 346 ms
18,972 KB
testcase_13 AC 378 ms
19,008 KB
testcase_14 AC 346 ms
18,920 KB
testcase_15 AC 419 ms
18,952 KB
testcase_16 AC 376 ms
20,440 KB
testcase_17 AC 22 ms
9,248 KB
testcase_18 AC 671 ms
23,528 KB
testcase_19 AC 793 ms
31,408 KB
testcase_20 AC 310 ms
19,664 KB
testcase_21 AC 387 ms
15,720 KB
testcase_22 AC 578 ms
19,272 KB
testcase_23 AC 21 ms
9,236 KB
testcase_24 AC 21 ms
9,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int, input().split())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
from decimal import Decimal
b=B[0]
import heapq
C=[];e=10**40
for i in range(N):
  x=-(e*A[i]-i)
  c=Decimal(x)/Decimal(b)
  heapq.heappush(C,(c,i,0))
#print(C)  
for _ in range(M):
  c,i,r=heapq.heappop(C)
  print(i+1)
  if r+1==M:
    continue 
  x=-(e*A[i]-i)
  cc=Decimal(x)/Decimal(B[r+1])
  heapq.heappush(C,(cc,i,r+1))
  #print(C)
0