Created
October 31, 2022 00:04
-
-
Save modos/922fc56dd318bff35d0ca3aa0f3de54d to your computer and use it in GitHub Desktop.
باقر خستهست ولی بیفرهنگ نه
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
numof, to_univ = [int(i) for i in input().split()] | |
redlamps = list() | |
# LENGTH , RED , GREEN | |
for i in range(numof): | |
redlamps.append([int(i) for i in input().split()]) | |
which = 0 | |
where = 0 | |
while where < to_univ: | |
iso = False | |
# print('WHERE:', where) | |
# print('Time:', which) | |
# print() | |
for i in redlamps: | |
iso = False | |
if i[0] == where: | |
# print(i[1] , which % (i[1] + i[2])) | |
if i[1] > which % (i[1] + i[2]): | |
which += i[1] - which % (i[1] + i[2]) | |
else: | |
iso = True | |
if iso: | |
which += 1 | |
where += 1 | |
print(which + 1) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment