随笔分类 -  图论:生成树

摘要:给定一颗树,把它扩充成完全图.求需要的最小边权和 struct Edge { int x,y,z; }e[N]; int T,n; int fa[N],sz[N]; int get(int x) { if(x==fa[x]) return x; return fa[x]=get(fa[x]); } 阅读全文
posted @ 2022-01-15 17:40 __iostream 阅读(19) 评论(0) 推荐(0) 编辑
摘要:最短路径树计数 树的计数问题 我们考虑类似prim的方式 维护树的一部分 这样就可以用乘法原理了 #include <iostream> #include <cstdio> #include <cstring> #include <queue> #include <vector> #include 阅读全文
posted @ 2022-01-15 17:39 __iostream 阅读(27) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示