結果

問題 No.2453 Seat Allocation
ユーザー ikomaikoma
提出日時 2023-09-01 23:46:21
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 611 bytes
コンパイル時間 342 ms
コンパイル使用メモリ 87,164 KB
実行使用メモリ 135,552 KB
最終ジャッジ日時 2023-09-01 23:46:47
合計ジャッジ時間 19,706 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,548 KB
testcase_01 AC 75 ms
71,388 KB
testcase_02 AC 74 ms
71,388 KB
testcase_03 AC 76 ms
71,532 KB
testcase_04 AC 75 ms
71,188 KB
testcase_05 AC 983 ms
101,620 KB
testcase_06 WA -
testcase_07 AC 246 ms
95,528 KB
testcase_08 AC 207 ms
81,652 KB
testcase_09 TLE -
testcase_10 TLE -
testcase_11 TLE -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 255 ms
92,964 KB
testcase_15 WA -
testcase_16 AC 358 ms
90,872 KB
testcase_17 AC 81 ms
75,588 KB
testcase_18 AC 1,381 ms
117,788 KB
testcase_19 AC 1,711 ms
127,168 KB
testcase_20 AC 405 ms
85,588 KB
testcase_21 AC 915 ms
98,912 KB
testcase_22 AC 1,393 ms
117,736 KB
権限があれば一括ダウンロードができます

ソースコード

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)
        heappush(heap, pi)
        pi2 = heappop(heap)
        if pi==pi2:break

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