#P5958. [POI 2017] Sabotaż
[POI 2017] Sabotaż
Problem Description
A company has people, and the superior-subordinate relationships form a rooted tree. There is one traitor (it is unknown who it is).
For a person, if among their subordinates (direct or indirect, not including themself), the proportion of traitors exceeds , then this person will also become a traitor, and all of their subordinates will become traitors as well. You need to find the minimum such that, in the worst case, the number of traitors will not exceed .
Input Format
The first line contains two positive integers .
In the next lines, the -th line contains a positive integer , meaning that the parent of is .
Output Format
Output one real number . Any answer with an absolute or relative error within is accepted.
9 3
1
1
2
2
2
3
7
3
0.6666666667
Hint
Sample Explanation
In the answer, is actually a number that approaches infinitely closely but is greater than .
Because when , in the worst case, are all traitors, which exceeds .
Constraints
For of the testdata, , .
Translated by ChatGPT 5