You are viewing a single comment's thread. Return to all comments →
def solve(a): min_bus, max_bus = max(a), sum(a) buses = {} current = 0 for ai in a: buses = {i: (bus+ai) % i \ for i,bus in buses.items() \ if bus+ai <= i} current += ai if max_bus % current == 0 and current >= min_bus: buses[current] = 0 return sorted(list(buses.keys()))
Seems like cookies are disabled on this browser, please enable them to open this website
Bus Station
You are viewing a single comment's thread. Return to all comments →