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

【树状dp】 首先要看出是棵树,然后很简单了,记录每个节点向下路径的最长和次长,

Posted by WilliamACM at 2012-07-07 20:23:39 on Problem 2631
if(f[s].f+v>f[r].f)
        {
            f[r].s=f[r].f;f[r].f=f[s].f+v;
        }
        else f[r].s=max(f[r].s,f[s].f+v);

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