_what

博客园 首页 新随笔 联系 订阅 管理

2019年10月18日 #

摘要: 最近公共祖先二 离线算法 / / include include include include include include include include include include include include typedef long long LL; typedef unsigne 阅读全文
posted @ 2019-10-18 19:29 _what 阅读(135) 评论(1) 推荐(0) 编辑

摘要: LCA离线算法的应用:在带权树中求任意两点的距离。 "离线"是指求出答案之后保存起来,最后一起输出。(在一次遍历中把所有询问一次性解决。) Tarjan算法的基本步骤: 1.任选一个点作为根节点,从该点开始dfs遍历 2.遍历该点u的子树中所有节点,并标记这些点的被访问状态 3.如果v还有子树中的节 阅读全文
posted @ 2019-10-18 15:26 _what 阅读(132) 评论(0) 推荐(0) 编辑