結果
| 問題 | No.3325 陰陽師 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-01-27 08:10:38 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 1,801 ms / 2,000 ms |
| コード長 | 587 bytes |
| 記録 | |
| コンパイル時間 | 320 ms |
| コンパイル使用メモリ | 82,644 KB |
| 実行使用メモリ | 173,708 KB |
| 最終ジャッジ日時 | 2026-01-27 08:11:14 |
| 合計ジャッジ時間 | 34,853 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
from bisect import bisect_left
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 = 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))
S1[ind] = x-1
if flag:
ans = a
low = mid
else:
high = mid
print(ans)