Logo
(追記) (追記ここまで)

8362번 - Near 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB159936251.667%

문제

A known Polish proverb is: 'The apple always falls near the apple tree'1. Your task is to check this proverb experimentally. For simplicity let us assume that both apple trees and apples stand in one line, so their positions can be described by a single coordinate. Let us also assume that every apple has fallen from the apple tree closest to it.

Write a program that:

  • reads from the standard input a description of positions of apple trees and apples,
  • computes the smallest distance between an apple and its apple tree,
  • writes the result to the standard output.

1An English equivalent of this proverb is: 'Like father, like son' or 'Like mother, like daughter'.

입력

The first line of input contains two integers n and m (1 ≤ n, m ≤ 100 000), separated with a single space and denoting the number of apple trees and the number of apples. The second line of input contains n integers from the range [0,108], separated with single spaces and denoting the coordinates of apple trees. The third line of input contains m integers from the range [0,108], separated with single spaces and denoting the coordinates of apples. We treat both apple trees and apples as points on a line; there can be multiple apple trees and multiple apples in one point.

출력

The first and only line of output should contain the smallest distance between an apple and its apple tree.

제한

예제 입력 1

3 5
10 1 4
2 2 5 7 8

예제 출력 1

1

힌트

출처

Contest > Algorithmic Engagements > PA 2008 7-0번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /