Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #https://inf-ege.sdamgia.ru/problem?id=48443
- data = open('22 (4).csv').readlines()[1:]
- n = len(data)
- ids = {}
- tt = [0] * n
- prev = [[] for i in range(n)]
- for i in range(n):
- ind, t, *args = data[i].split(';')[:-2]
- ind = int(ind)
- ids[ind] = i
- t = int(t)
- tt[i] = t
- for e in args:
- if e != '':
- x = ids[int(e.replace('"', ''))]
- prev[i].append(x)
- answ = [0] * n
- for i in range(n):
- answ[i] = tt[i]
- for lst in prev[i]:
- answ[i] = max(answ[i], answ[lst] + 3 + tt[i])
- print(max(answ))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement