Given a tree with N nodes rooted at 1, each node has val a[i]
There are three types of queries: 1 x k v for all node y which distance to x is exactly k, add v to a[y], then output the maximum value of these a[y] 2 x k v for all node y which distance to x not exceed k, add v to a[y], then output the maximum value of these a[y] 3 x v for all node in subtree x, add v to a[y], then output the maximum value of these a[y]
It is guarantee that k is less than 10
Please help me with this problem. Thank you so much!