Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
给后面的人一点提示k为遍历的起始节点,我们把图看成一颗树,k当成树的根。对于每个节点遍历他所有子树,如果子树中包含要遍历的点,那么我们肯定需要走到这个子树上,我们用cost和save表示某个节点走到所有有用的子树并返回所需要花费和某点走到一个子树不返回所需要的花费。那么答案就是根结点cost-save. Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator