随笔分类 -  树——虚树

摘要:Description "题目链接" Solution 在虚树上跑DP即可 关于虚树的建立,是维护一个最右链的过程 关键代码如下: c++ sort(A+1,A+k+1,cmp);//按dfs序排序 s[top=1]=1;//栈维护最右链 for(int i=1;i1&&dep[f] include 阅读全文
posted @ 2018-03-30 19:12 void_f 阅读(144) 评论(0) 推荐(0)
摘要:Description "题目链接" Solution 在虚树上跑DP即可 Code c++ include include include include define ll long long define N 250010 using namespace std; const ll Inf=1 阅读全文
posted @ 2018-03-30 19:08 void_f 阅读(156) 评论(0) 推荐(0)