結果

問題 No.2453 Seat Allocation
ユーザー ikomaikoma
提出日時 2023-09-01 23:49:29
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 618 bytes
コンパイル時間 1,032 ms
コンパイル使用メモリ 87,308 KB
実行使用メモリ 105,728 KB
最終ジャッジ日時 2023-09-01 23:49:37
合計ジャッジ時間 5,526 ms
ジャッジサーバーID
(参考情報)
judge16 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
71,404 KB
testcase_01 AC 75 ms
71,472 KB
testcase_02 AC 80 ms
71,596 KB
testcase_03 AC 76 ms
71,548 KB
testcase_04 AC 92 ms
75,820 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

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()))
Ai = [(a,i) for i,a in enumerate(A)]
Ai.sort(reverse=True)
a,i = Ai[0]
offset = 1<<30
f = lambda a,b,i: (((a*offset//b)<<20) +M-i)
heap = [ f(a,b,i) for b in B]
heapify(heap)

for a,i in Ai[1:]:
    for b in B:
        pi = f(a,b,i)
        if heap[0]==pi:break
        heappush(heap, pi)
        pi2 = heappop(heap)

ans = []
while heap:
    pi = heappop(heap)
    i = pi & ((1<<20)-1)
    i = M-i
    ans.append(i+1)

ans = reversed(ans)
print(*ans,sep="\n")


0