提出 #75534442


ソースコード 拡げる

from bisect import bisect_left

N, M = map(int, input().split())
A = sorted(map(int, input().split()))

ans = 2**60
for b in map(int, input().split()):
  t = bisect_left(A, b)
  if t > 0:
    ans = min(ans, abs(A[t-1]-b))
  if t < N:
    ans = min(ans, abs(A[t]-b))

print(ans)

提出情報

提出日時
問題 F - Min Difference
ユーザ rk_haskey
言語 Python (PyPy 3.11-v7.3.20)
得点 300
コード長 290 Byte
結果 AC
実行時間 183 ms
メモリ 146960 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 3
AC × 20
セット名 テストケース
Sample example_00.txt, example_01.txt, example_02.txt
All example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, small_00.txt, small_01.txt, small_02.txt, small_03.txt, small_04.txt
ケース名 結果 実行時間 メモリ
example_00.txt AC 53 ms 80060 KiB
example_01.txt AC 53 ms 80040 KiB
example_02.txt AC 53 ms 80100 KiB
hand_00.txt AC 114 ms 146960 KiB
hand_01.txt AC 120 ms 141276 KiB
random_00.txt AC 141 ms 142360 KiB
random_01.txt AC 142 ms 142380 KiB
random_02.txt AC 141 ms 142260 KiB
random_03.txt AC 183 ms 142364 KiB
random_04.txt AC 180 ms 142304 KiB
random_05.txt AC 181 ms 142736 KiB
random_06.txt AC 180 ms 142900 KiB
random_07.txt AC 181 ms 142480 KiB
random_08.txt AC 182 ms 142260 KiB
random_09.txt AC 182 ms 142116 KiB
small_00.txt AC 67 ms 95972 KiB
small_01.txt AC 69 ms 97920 KiB
small_02.txt AC 66 ms 95892 KiB
small_03.txt AC 70 ms 99656 KiB
small_04.txt AC 62 ms 91504 KiB