Untitled

mail@pastecode.io avatar
unknown
python
a year ago
256 B
4
Indexable
with open("22.txt") as file:
    d = {'0': 0}
    for elem in file.readlines():
        elem = elem.replace("\t", " ")
        num, dur, *subs = elem.replace(';', ' ').split()
        d[num] = max([d[i] for i in subs]) + int(dur)
    print(max(d.values()))