
树的dfs和bfs相关
BUAA_Alchemist
这个作者很懒,什么都没留下…
展开
-
【树的DFS】codeforces1084D The Fair Nut and the Best Path
D. The Fair Nut and the Best Path time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard output The Fair Nut is going to travel to the Tree Country, in whic...原创 2018-12-12 00:36:52 · 459 阅读 · 0 评论 -
【动态规划】【树的dfs】【LCA】codeforces1111E Tree
E. Tree time limit per test1.5 seconds memory limit per test256 megabytes inputstandard input outputstandard output You are given a tree with n nodes and q queries. Every query starts with three integ...原创 2019-02-05 14:40:07 · 538 阅读 · 0 评论 -
【线段树】【LCA的RMQ求法】【树上路径求交】车站
链接:https://ac.nowcoder.com/acm/contest/368/E 来源:牛客网 很好的一道题,一开始没有想到从路径来建立线段树,总想着从原树上搞,还觉得和树链剖分有点相似,后来看了题解才知道自己完全想错了。 车站 线段树+倍增+LCA。 首先车站一定在所有铁路的经过的点的交集上,所以可以用线段树求出区间路径的交集,同时维护离路径交的两个端点最远的点。找到出了最远的两个点...原创 2019-02-22 12:21:35 · 1078 阅读 · 1 评论