godfather专题

poj 3107 Godfather(树形DP,点的个数较多, 删点使得剩余部分结点最多的最小值)

1、http://poj.org/problem?id=3107 2、题目大意; 有n个点,已知他们之间的关系,连接是双向的,求删除哪个点可以使得剩下的各个部分的点的个数最少 用一个cnt[]数组记录下每个点有多少个子节点 那么我们要求的删除根节点u后剩余部分的最大数就是要么是u的子树中的最大值,要么是除去以u为根的树外的剩余结点数dp[u]=max(max(cnt[v]),n-cnt[u

Godfather (树形dp + 树的重心)

题目:Godfather Last years Chicago was full of gangster fights and strange murders. The chief of the police got really tired of all these crimes, and decided to arrest the mafia leaders. Unfortunately,