![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
图/搜索
Andrearn
长风破浪
展开
-
【题解】Fathest Node in a Tree - 边表法
//Source:https://vjudge.net/contest/147767#problem/C//题意:有一颗树,找出树上最长的路径//思路:用【vector<node> tree[]】 来表示这棵树,然后两次bfs找最长路径 (用dfs 会 Memory Limit Exceed...)/* @ vector: 可变长数组1、声明:vector<int> arr;2、向末尾添加元原创 2017-01-17 22:24:36 · 219 阅读 · 0 评论 -
【题解】Fathest Node in a Tree - 链式前向星
//Source:https://vjudge.net/contest/147767#problem/C//题意:有一颗树,找出树上最长的路径//思路:用【链式前向星】 来表示这棵树,然后两次dfs找最长路径#include <cstdio>#include <queue> // bfs 要用队列 #include <cstring> // memsetusing namespace st原创 2017-01-17 22:25:24 · 216 阅读 · 1 评论