章若楠__
章若楠__
全部文章
分类
题解(1)
归档
标签
去牛客网
登录
/
注册
章若楠__的博客
全部文章
(共1篇)
题解 | #小红的对错判断#
题意:她想知道树上所有节点到该路径的最短路之和是多少 题解:LCA(用于求两个点之间的距离)+换根DP(求每个点为根,其他点到根的距离) ans=(dp[x]+dp[y]-n*dist(x,y))/2 #include <bits/stdc++.h> using namespace st...
2024-10-21
3
48