Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Short & basic solution in Speedy category for Node Disconnected Users by christopher.erlinger
def disconnected_users (x, y, z, o):
who_works = int(str(y[z[0]]))
live_node = [z] #who definitely works
total_pot = sum(y.values())
if str(z) == str(o[0]): #if the person sending is out, then we need max pigeons
return total_pot
for item in x: #this block makes a list of every node that is active and not attached to a dead node
if item[0] in live_node:
if item[1] not in o:
if item[1] not in live_node:
live_node.append(item[1])
for item in x: #since we now have all of the working nodes in a list, we can just add up how many times
#they talk to each other, without a deadnode getting in the way
if item[0] in live_node:
if item [1] not in o:
who_works = who_works + int(str(y[item[1]]))
return total_pot - who_works #now we subtract who works from who potentially does not work
May 16, 2018