Skip to content

Instantly share code, notes, and snippets.

@IKKO-Ohta
Last active June 30, 2017 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IKKO-Ohta/cd4ebffbec6af39d15c5575a359f02fb to your computer and use it in GitHub Desktop.
Save IKKO-Ohta/cd4ebffbec6af39d15c5575a359f02fb to your computer and use it in GitHub Desktop.
T = int(input())
N = int(input())
A = [int(x) for x in input().split()]
M = int(input())
B = [int(x) for x in input().split()]
takos = [[tako,tako+T,True] for tako in A]
for cus in B:
cus_empty = True
for tako in takos:
if tako[2] == True and (tako[0] <= cus <= tako[1]):
tako[2] = False
cus_empty = False
break
if cus_empty: print("no") ; exit(0)
print("yes")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment