Files
kattis/transitwoes.py
2023-06-26 22:33:12 +02:00

16 lines
493 B
Python

s, t, n = map(int, input().split()) # start time, class time, transit routes
d = list(map(int, input().split())) # d(0)...d(n+1) # walking times
b = list(map(int, input().split())) # b(0)...b(n) # ride times
c = list(map(int, input().split())) # c(0)...c(n) # bus arrival intervals
s += d[0]
for i in range(n):
passed_arrival_time = s % c[i]
if passed_arrival_time > 0:
s += c[i] - passed_arrival_time
s += b[i]
s += d[i + 1]
print("yes" if s <= t else "no")