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

小问题调试了很久终于AC,注意DP的顺序。。

Posted by gympp at 2011-08-26 19:46:54 on Problem 2486
f[i][j][1]表示以i为根走j步 不回到i点 可得的最大值
f[i][j][0]表示以i为根走j步 且回到i点 可得的最大值
f[i][j+p][0]=max(f[i][j+p][0],f[i][j][0]+f[son[i]][p-2][0])
f[i][j+p][1]=max(f[i][j+p][1],f[i][j][0]+f[son[i]][p-1][1])
对于一个节点出发走出j步,他所走向的所有儿子中,至多有走向一个儿子的路径是不用回到他本身的..枚举这个儿子

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