Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Node Disconnected Users by kdim
def disconnected_users(net, users, source, crushes):
for i in crushes: # get all net without crushes
net = list(filter(lambda x: i not in x, net)) #
s=source
for i in net: # create chains station with source
s += "".join(["".join(i) for j in s if j in i]) #
s = "".join(set(s)) # s = all station can connect with source
if [source] == crushes: return sum(users.values()) # if source = crushes then return all (100%)
return sum(users.values())-sum([users[i] for i in s]) # return all - sources users
Jan. 9, 2021
Comments: