Bob has a tree with
The weight of a path on Bob's tree is defined as the number of distinct colours occuring over the vertices of the path.
Bob wants to perform
The first line of input consists of two integers,
Output one line for every action taken of type 2 or 3. Each line should contain a single integer, the weight of the queried path for type 2 actions, or the maximum weight of a valid path for type 3 actions.
Subtask # | Score | Constraints |
---|---|---|
1 | 10 | |
2 | 20 | No actions of type 2 will occur. |
3 | 20 | No actions of type 3 will occur. |
4 | 10 | The parent of every vertex |
5 | 40 | No additional constraints |
Sample Input 1 | Sample Output 1 |
5 6
|
3
|
Subtask | Score |
---|---|
1 | 10 |
2 | 20 |
3 | 20 |
4 | 10 |
5 | 40 |