Replies: 14 comments 4 replies
-
能把代码里的宏定义去掉吗,感觉好难看懂啊 |
Beta Was this translation helpful? Give feedback.
-
盲猜这是xiaodao的宏定义 |
Beta Was this translation helpful? Give feedback.
-
所以这些宏定义是怎么定义的...RD, PB都是啥啊/yiw |
Beta Was this translation helpful? Give feedback.
-
补充一下:两次DFS的方法不适用于有负权边的树 |
Beta Was this translation helpful? Give feedback.
-
bfs也能求吧,虽然与dfs思路相同 |
Beta Was this translation helpful? Give feedback.
-
这个...dfs的证明是不是错了啊.. |
Beta Was this translation helpful? Give feedback.
-
就是求出距离某一个点最远的点就行了,显然dfs最方便 |
Beta Was this translation helpful? Give feedback.
-
没看出树形dp的实现和“dp”这个概念有什么关系? |
Beta Was this translation helpful? Give feedback.
-
两次DFS的反证法的第三种情况: |
Beta Was this translation helpful? Give feedback.
-
void dfs(int u, int fa) {
for (int v : G[u]) if (v != fa) {
dfs(v, u);
res = max(res, dp[u] + 1 + dp[v]);
dp[u] = max(dp[u], dp[v] + 1);
}
} 可以用 |
Beta Was this translation helpful? Give feedback.
-
这个反证法的证明对我来说理解起来可能没有那么形象、直观,我想了想也许可以这么理解(大佬勿喷): |
Beta Was this translation helpful? Give feedback.
-
大佬们教教dp算直径怎么找到直径的端点 |
Beta Was this translation helpful? Give feedback.
-
有几个问题:这里的fa是什么意思,节点是从0开始吗,为什么是i<n。 |
Beta Was this translation helpful? Give feedback.
-
https://oi-wiki.org/graph/tree-diameter/
OI Wiki 是一个编程竞赛知识整合站点,提供有趣又实用的编程竞赛知识以及其他有帮助的内容,帮助广大编程竞赛爱好者更快更深入地学习编程竞赛
Beta Was this translation helpful? Give feedback.
All reactions