Problem 2378 · Medium

Choose Edges to Maximize Score in a Tree

Post-order tree DP on two states per node: free or matched to one child, with empty selections allowed.

Open the interactive visualisation