Advertisement
Bad_Programist

Untitled

Jan 20th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.38 KB | None | 0 0
  1. Num1 = int(input())
  2. Color1 = list(map(int, input().split()))
  3. Num2 = int(input())
  4. Color2 = list(map(int, input().split()))
  5. i = 0
  6. j = 0
  7. S = [Color1[i], Color2[j]]
  8. while i < len(Color1) and j < len(Color2):
  9.     if abs(S[1] - S[0]) > abs(Color1[i] - Color2[j]):
  10.         S = [Color1[i], Color2[j]]
  11.     if Color1[i] < Color2[j]:
  12.         i += 1
  13.     else:
  14.         j += 1
  15. print(*S)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement