結果

問題 No.2453 Seat Allocation
ユーザー ikomaikoma
提出日時 2023-09-02 00:05:32
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 402 bytes
コンパイル時間 1,001 ms
コンパイル使用メモリ 87,304 KB
実行使用メモリ 106,708 KB
最終ジャッジ日時 2023-09-02 11:15:14
合計ジャッジ時間 7,746 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,156 KB
testcase_01 AC 75 ms
71,448 KB
testcase_02 AC 75 ms
71,572 KB
testcase_03 AC 76 ms
71,500 KB
testcase_04 AC 76 ms
71,152 KB
testcase_05 AC 297 ms
106,512 KB
testcase_06 AC 161 ms
90,916 KB
testcase_07 AC 170 ms
93,384 KB
testcase_08 AC 157 ms
79,728 KB
testcase_09 AC 413 ms
106,388 KB
testcase_10 AC 406 ms
106,708 KB
testcase_11 AC 400 ms
106,160 KB
testcase_12 AC 232 ms
90,668 KB
testcase_13 AC 233 ms
91,056 KB
testcase_14 AC 139 ms
90,120 KB
testcase_15 AC 283 ms
90,924 KB
testcase_16 AC 277 ms
90,352 KB
testcase_17 AC 76 ms
71,452 KB
testcase_18 AC 323 ms
95,416 KB
testcase_19 AC 376 ms
103,632 KB
testcase_20 AC 239 ms
85,568 KB
testcase_21 AC 232 ms
86,244 KB
testcase_22 AC 307 ms
91,472 KB
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from heapq import *

N,M=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
idxs = [1]*N
heap = [ (-a/B[0],i) for i,a in enumerate(A)]
heapify(heap)
while M:
    _,i = heappop(heap)
    print(i+1)
    M-=1
    j = idxs[i]
    idxs[i] = j+1
    if j<len(B):
        b = B[j]
        a = A[i]
        heappush(heap, (-a/b, i))
0