摘要: dfs找出所有节点所在树及到树根的距离及深度及父亲。 i和j在一棵树上,则最短路为dis[i]+dis[j]-dis[LCA(i,j)]*2。 阅读全文
posted @ 2016-08-07 23:44 水郁 阅读(303) 评论(0) 推荐(0) 编辑
……