Recently, I've just encountered this problem:
Given a tree with $$$n$$$ vertices and rooted at $$$1$$$. Each vertex has an initial value, and initially, all these values are $$$0$$$.
There are $$$q$$$ queries of two types:
- "1 u": Find the sum of values of vertices in the subtree rooted at u.
- "2 u": Find the value at vertex u.
- "3 u v x": Increase the values of vertices on the simple path from u to v by x.
Answer the queries of type 1 and 2.
Constraints
Are there any tricks to handle these types of queries with Euler Tour? I've thought about this problem for several days and haven't come up with any idea how to do it yet because of the update path queries.