Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

终于过了,每个点有3个状态。。

Posted by 332404521 at 2009-08-29 12:45:27 on Problem 3659
f[i][0],第i个点放塔,并且以i为根的子树全部被覆盖所放最少塔数
f[i][1],第i个点不放塔,并且以i为根的子树全部被覆盖所放最少塔数
f[i][2],第i个点的所有子树全部被覆盖所放最少塔数,第i个点没有被覆盖
然后任意取个根,记忆化搜索吧。。
建树的话,用前向星,搜索到某个时判断当前点是否被访问过,被访问过exit。
特殊情况:当第i点为叶子时,f[i][1]=1;

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator