Problem 3772 · Hard

Maximum Subgraph Score in a Tree

Root the tree at each node and add a child subtree only when its best connected score is positive.

Open the interactive visualisation