The WSA used to tap a lot of phone lines - it's a great way of catching evil plots that the terrorist cells carelessly discuss between themselves using the public phone system. Lately, the WSA had to reduce costs by cutting back on traditional wiretapping, and they are trying to determine which few phone lines they will concentrate their remaining resources on. There is a large list of terrorist cell relationships, otherwise known as phone lines (collected by other means). |
![]() http://openclipart.org/detail/99967/black-orange-men-cloud-by-pydubreucq |
When the Head of Bad People decides to do something Evil, he hatches the Master Plan; the plan is then broadcast to all cells, using the public phone network.
The WSA assumes that terrorists behave rationally, thus:
A talented young agent has chosen a phone line the tap is installed on. Your task is to determine the probability of catching the important broadcast, whichever connection setup the terrorist chose this time.
The wiretap is placed on the first connection on the list.
Example input6 12 0 1 1 2 2 3 3 4 4 5 3 0 0 2 1 3 2 4 3 5 4 0 5 1 | Example output0.4194444444 |