Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Num1 = int(input())
- Color1 = list(map(int, input().split()))
- Num2 = int(input())
- Color2 = list(map(int, input().split()))
- i = 0
- j = 0
- res = 'NO'
- while i < Num1 and j < Num2:
- if abs(Color1[i] - Color2[j]) == 1:
- res = 'YES'
- break
- if Color1[i] < Color2[j]:
- i += 1
- else:
- j += 1
- print(res)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement