2015年3月26日

LCA 求 树中两个点的距离

摘要: PS:在树中:dis(u,v)=dis(root,v)+dis(root,u)-2*dis(root,lca(u,v)); 这个性质可以写很多题。vectormp[N];int dp[N][LN];int dep[N];void dfs(int u,int fa,int t) //dfs(roo... 阅读全文

posted @ 2015-03-26 19:21 forgot93 阅读(569) 评论(0) 推荐(0) 编辑

导航