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 |
【树状dp】 首先要看出是棵树,然后很简单了,记录每个节点向下路径的最长和次长,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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator