Alice and Bob get a strange firework accidentally, and they never know how to play it, so they come to you for help. The firework consists of n nodes and n-1 fuses connecting pairs of nodes. The whole firework forms an undirected tree. At the time 0, several nodes are ignited simultaneously. After that, the fire begins to spread through the fuses to all directions from those nodes which has been ignited. When the fire reaches another node that haven't been ignited before, it will ignite the node and keep spreading. Fire has a specific speed. If the fuse has the length L, it needs 2L seconds to conduct the fire. Then the question comes: how long it will take to burn up the firework?We consider that the firework is burned up if and only if all the fuses are burned up.
Alice and Bob get a strange firework accidentally, and they never know how to play it, so they come to you for help. The firework consists of n nodes and n-1 fuses connecting pairs of nodes. The whole firework forms an undirected tree. At the time 0, several nodes are ignited simultaneously. After that, the fire begins to spread through the fuses to all directions from those nodes which has been ignited. When the fire reaches another node that haven't been ignited before, it will ignite the node and keep spreading. Fire has a specific speed. If the fuse has the length L, it needs 2L seconds to conduct the fire. Then the question comes: how long it will take to burn up the firework? We consider that the firework is burned up if and only if all the fuses are burned up.