시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 512 MB | 2 | 2 | 2 | 100.000% |
Recently, Rikka became the boss of a big company. There are $n$ employees in Rikka's company, indexed from $1$ to $n$. Employee $1$ is Rikka herself.
Each employee except Rikka has a direct supervisor. The direct supervisor of the $i$-th employee is the $p_i$-th employee. The supervision relationship constitutes a tree. Employee $u$ is a subordinate of Employee $v$ if and only if $v$ is the direct supervisor or an indirect supervisor of $u$.
To encourage employees, Rikka decides to let each employee experience the feeling of being the boss. To achieve this, Rikka will give some employees a holiday. For an employee, he/she will feel like the boss only when the following three conditions are satisfied:
Now, Rikka is going to make a plan. In the beginning, all employees are at work. In each day, Rikka can make one of the following actions:
Rikka wants you to make a plan. Since it is expensive to give employees holidays, you are required to make every employee feel like the boss and interview them within $9 \times 10^6$ days.
The first line contains a single integer $n\ (1 \leq n \leq 10^5)$, the number of employees.
The second line contains $n-1$ integers $p_2, \dots, p_n\ (1 \leq p_i < i)$, representing the direct supervisor of each employee.
Output a single line with a single string. From left to right:
Besides, Substring "!" represents that all actions are finished. Any characters after "!" will be ignored.
Your answer will be regarded as correct if and only if the following three conditions are satisfied:
6 1 1 2 3 3
=1+1+3+5+6=2+2=4----+4+2=3+3+6=5-+5=6!