結果

問題 No.3325 陰陽師
コンテスト
ユーザー flippergo
提出日時 2026-01-26 23:26:20
言語 PyPy3
(7.3.17)
結果
TLE  
実行時間 -
コード長 662 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 281 ms
コンパイル使用メモリ 82,576 KB
実行使用メモリ 123,176 KB
最終ジャッジ日時 2026-01-26 23:26:27
合計ジャッジ時間 6,895 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other TLE * 1 -- * 29
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from bisect import bisect_left
from collections import deque
N,M = map(int,input().split())
S = list(map(int,input().split()))
S = sorted(S)
T = list(map(int,input().split()))
ans = 0
high = M+1
low = 0
while high-low>1:
    mid = (high+low)//2
    T1 = sorted(T[:mid])
    S1 = deque(S[:])
    a = 0
    flag = True
    for i in range(mid):
        x = T1[i]
        ind = bisect_left(S1,x)
        if ind==len(S1):
            flag = False
            break
        else:
            a = max(a,abs(S1[ind]-x))
            for j in range(ind+1):
                S1.popleft()
    if flag:
        ans = a
        low = mid
    else:
        high = mid
print(ans)
0