From d46ba5f92fd12132eebde4aaa939cd5f5d9d6aaf Mon Sep 17 00:00:00 2001 From: Jethro Stapelbroek Date: Mon, 26 Jun 2023 22:33:12 +0200 Subject: [PATCH] Transit Woes --- transitwoes.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 transitwoes.py diff --git a/transitwoes.py b/transitwoes.py new file mode 100644 index 0000000..cc9409d --- /dev/null +++ b/transitwoes.py @@ -0,0 +1,15 @@ +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")