# Water in a Tree

PIHACKS'21-CodeJam

Let the equation for mix water from two nodes $a$ and $b$ is $T_c = (T_a​×S_a​ + T_b​×S_b)​/(Sa​+Sb​)$.

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.

### Statistics

75% Solution Ratio
gokul.rajEarliest, Aug '21
merIinFastest, 0.1s
merIinLightest, 21 MB
merIinShortest, 2447B