Seeing as there's no blogpost from chrome about the round a few hours before it...
TC SRM 692 starts soon. If you're up at night, you can participate!
UPD: Contest over! As you may have noticed, I was the writer; it's worth it to read the problem of both divisions just for the stories.
Hints:
TreeSumshint 0The optimal node is either centroid.
hint 1Centroids can be computed using something like LCA or a binary search.
hint 2Think in terms of various sums over 2k ancestors of each vertex, just like the jumps to the 2k-th ancestor used to compute LCAs.
LinenCenterhint 1Solve the case K = 1 first.
hint 2Fast exponentiation of arrays.
HardProof hint 2Binary search (or 2 pointers in a different approach).
DubsWhat's the answer when R and L are divisible by 100?