Skip to content

Instantly share code, notes, and snippets.

@IKKO-Ohta
Created July 15, 2017 05:22
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/e9da8af200fe1d69415d968012a53265 to your computer and use it in GitHub Desktop.
Save IKKO-Ohta/e9da8af200fe1d69415d968012a53265 to your computer and use it in GitHub Desktop.
# coding: utf-8
# Here your code !
from queue import Queue
Aq = Queue()
Bq = Queue()
nums = [int(x) for x in input().split()]
N,M = nums[0],nums[1]
nums = [int(x) for x in input().split()]
X,Y = nums[0],nums[1]
nums = [int(x) for x in input().split()]
for num in nums: Aq.put(num)
nums = [int(x) for x in input().split()]
for num in nums: Bq.put(num)
time = 0
cnt = 0
t = 0
n_flight = -1
while(1):
while(1):
try:
n_flight = Aq.get(False)
except:
print(cnt)
exit(0)
if n_flight >= time :
time = n_flight + X
break
while(1):
try:
n_flight = Bq.get(False)
except:
print(cnt)
exit(0)
if n_flight >= time :
time = n_flight + Y
break
cnt += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment