Recently, I solved 342E - Xenia and Tree using Sqrt decomposition.
The problem have two types of queries:
- Color node $$$x$$$ red
- Find minimum distance to any red color
I thought, what will be the solution if there is query: Color node $$$x$$$ blue?
I'm not sure if this is solvable using centroid decomposition, but is there another way?
Input all queries in advance and reverse them. Then use code code of 342E. AC.