Downhill

You have started working for the Umbristan Secret Police where you are currently pursuing a criminal. Your chase has led you to a snowy mountaintop where you prepare to ski downhill to pursure them. When you pull out a map of the area is that there is a sprawling number of ski routes down the hill. Given all these paths that lead downhill and limited manpower, how can you spread out your men among the ski route exits to maximize the probability of catching the criminal? It is guaranteed that all paths have equal probability for the criminal to choose. Output the answer as an integer that represents the highest percent probability of catching the criminal rounded down. The paths that lead down are guarenteed to be acyclic. The top of the mountain is always denoted by node 0 and exists from the mountain are denoted by -1. Note that the paths will be in the form of an adjaceny list so the ith index in the array is a list that contains all the nodes it connects to.


This is a companion discussion topic for the original entry at https://algo.monster/problems/downhill/