随笔分类 - 图论#最小生成树
摘要:问题 I: Two Famous Companies 时间限制: 1 Sec 内存限制: 128 MB 题目描述 In China, there are two companies offering the Internet service for the people from all citie
阅读全文
摘要:#题意: 求生成树最长边与最短边的最小差值 #思路: #代码: const int maxn=1e4+100; struct node{ int u,v,w; }edge[maxn]; int root[maxn],n,m; bool cmp(node a,node b){ return a.w<b
阅读全文
摘要:#题意: n个城市,告诉每个城市的坐标,还有q个联通块,现在要把这n个城市连起来,可以购买联通块(每个有一定的费用),或者新建一条边(费用为点之间的距离的平方),问最小费用是多少。 #思路: 首先可以想到朴素的做法,二进制枚举每个连通块选还是不选,判断该状态下图是否已经联通,如果未联通的话再从朴素的
阅读全文

浙公网安备 33010602011771号