CF 191C Fools and Roads lca 或者 树链剖分
摘要:They say that Berland has exactly two problems, fools and roads. Besides, Berland hasncities, populated by the fools and connected by the roads. All B...
阅读全文
posted @
2015-10-13 13:18
_fukua
阅读(466)
推荐(0)
POJ 1986 DIstance Query LCA水题
摘要:给出一棵树,对于每一个询问,给出2个节点,输出2个节点的距离。输入中有字母,那个是没有用的,不用管。思路:0.选择编号为1的节点作为树的root(注意:有些题的边是单向的,这时候我们要根据节点的入度来确定root, 双向的话一般可以随意选择一个节点作为root)1.dfs1,求出dep和pa[...
阅读全文
posted @
2015-08-18 15:39
_fukua
阅读(256)
推荐(0)
POJ 2763 Housewife Wind LCA基础题
摘要:Time Limit:4000MSMemory Limit:65536KTotal Submissions:7047Accepted:1784DescriptionAfter their royal wedding, Jiajia and Wind hid away in XX Village, t...
阅读全文
posted @
2015-05-13 21:03
_fukua
阅读(530)
推荐(0)
HDU 3078 Network LCA水题
摘要:Problem DescriptionThe ALPC company is now working on his own network system, which is connecting all N ALPC department. To economize on spending, the...
阅读全文
posted @
2015-05-13 18:24
_fukua
阅读(294)
推荐(0)
HDU 2874 Connections between cities LCA水题 注意是森林,不是树
摘要:Problem DescriptionAfter World War X, a lot of cities have been seriously damaged, and we need to rebuild those cities. However, some materials needed...
阅读全文
posted @
2015-05-13 13:28
_fukua
阅读(240)
推荐(0)
HDU 2586 How Far Away? LCA水题
摘要:Problem DescriptionThere are n houses in the village and some bidirectional roads connecting them. Every day peole always like to ask like this "How f...
阅读全文
posted @
2015-05-13 01:11
_fukua
阅读(308)
推荐(0)