SRM780 Round 1 RestrictedLeaves

URL

https://community.topcoder.com/stat?c=problem_statement&pm=15963&rd=17853

solution

Calculate \ (dp (v, 0 / 1,0 / 1,0 / 1) \) , three \ (0/1 \) respectively indicate whether \ (v \) is in IS, the leaf with the smallest DFS in the subtree Whether it is in IS, the largest is in IS.

The transfer is \ (O (N) \) .

achieve

On the road

Guess you like

Origin www.cnblogs.com/iefnah06/p/12747416.html