Let the equation for mix water from two nodes and is .
We will use the Heavy Light Decomposition algorithm to solve this problem. The algorithm structure is a typical HLD algorithm. For the Segment Tree part, we will save the volume of water in each node and the temperature of the water. While mixing the waters, we will use the equation for mixing the water of two nodes.