結果

問題 No.2453 Seat Allocation
ユーザー ikomaikoma
提出日時 2023-09-01 23:52:37
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 618 bytes
コンパイル時間 385 ms
コンパイル使用メモリ 86,944 KB
実行使用メモリ 191,388 KB
最終ジャッジ日時 2023-09-01 23:53:05
合計ジャッジ時間 26,467 ms
ジャッジサーバーID
(参考情報)
judge16 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,492 KB
testcase_01 AC 75 ms
71,488 KB
testcase_02 AC 75 ms
71,480 KB
testcase_03 AC 104 ms
71,504 KB
testcase_04 AC 78 ms
71,428 KB
testcase_05 TLE -
testcase_06 AC 630 ms
114,548 KB
testcase_07 AC 186 ms
95,504 KB
testcase_08 AC 195 ms
81,260 KB
testcase_09 TLE -
testcase_10 TLE -
testcase_11 TLE -
testcase_12 AC 331 ms
93,100 KB
testcase_13 AC 429 ms
91,632 KB
testcase_14 AC 340 ms
101,980 KB
testcase_15 AC 1,592 ms
141,344 KB
testcase_16 AC 860 ms
120,320 KB
testcase_17 AC 82 ms
75,564 KB
testcase_18 AC 1,996 ms
158,940 KB
testcase_19 TLE -
testcase_20 AC 771 ms
106,088 KB
testcase_21 AC 1,250 ms
132,488 KB
testcase_22 AC 1,938 ms
163,488 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<<60
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