最近公共祖先LCA
Lesroad
这个作者很懒,什么都没留下…
展开
-
单向无权LCA模板(Tarjan)
Sample Input 2 16 1 14 8 5 10 16 5 9 4 6 8 4 4 10 1 13 6 15 10 11 6 7 10 2 16 3 8 1 16 12 16 7 5 2 3 3 4 3 1 1 5 3 5 Sample Output 4 3 2 题意:T组数据,n个点,n-1条边,最后一组查询公共祖先 题解:本题只有一组查询,暴力复杂度:N*原创 2017-08-19 14:36:56 · 173 阅读 · 0 评论 -
POJ1986Distance Queries(双向带权LCA)
Farmer John's cows refused to run in his marathon since he chose a path much too long for their leisurely lifestyle. He therefore wants to find a path of a more reasonable length. The input to this pr原创 2017-08-19 14:52:45 · 363 阅读 · 0 评论