Motivation
I spent hours on 914E - Palindromes in a Tree and finally solved it around 3 AM. The editorial was too short for me to follow, so here's my own version of the idea. Hopefully it's clearer for anyone else stuck on this. I apologize if my english is unclear.
Prerequisites
DFS, bitmasks, Centroid Decomposition.
Hints
Hint 1
Hint 2
Hint 3
Solution
Reveal
Code
Closing
I really enjoyed working on this problem — it's a great exercise in centroid decomposition. If this tutorial helped you, upvote! If anything is unclear, I would be happy to answer your questions in the comments.







