随笔分类 -  图论-最小生成树

摘要:简单说下思想(这里引用自http://blog.csdn.net/jarily/article/details/8883858) /* *算法引入: *设G=(V,E,w)是连通的无向图,T是图G的一棵最小生成树; *如果有另一棵树T1,满足不存在树T’,ω(T’)<ω(T1),则称T1是图G的次小 阅读全文
posted @ 2016-12-01 22:12 猪突猛进!!! 阅读(430) 评论(0) 推荐(0)
摘要:一点小变形就是了。。】#include<iostream> #include<cstdio> #define maxn 201 #define inf 999999 using namespace std; int n,m,mapp[maxn][maxn],dis[maxn],vis[maxn]; 阅读全文
posted @ 2016-08-24 20:26 猪突猛进!!! 阅读(158) 评论(0) 推荐(0)
摘要:#include<cstdio> #include<iostream> #include<string.h> #include<cmath> #define maxn 105 #define inf 9999999 int vis[maxn],n;//用来表示点是否在集合里 int mincost[ 阅读全文
posted @ 2016-08-24 20:22 猪突猛进!!! 阅读(166) 评论(0) 推荐(0)
摘要:include<cstdio> #include<iostream> #include<string.h> #include<cmath> #define maxn 105 #define inf 9999999 struct node { double x,y; }stu[maxn]; int v 阅读全文
posted @ 2016-08-24 20:20 猪突猛进!!! 阅读(156) 评论(0) 推荐(0)
摘要:嗯 水水的#include <cstdio> #include <cmath> #include<iostream> #include <algorithm> using namespace std; const int maxn = 10000+10; int pre[maxn]; int n,m 阅读全文
posted @ 2016-08-24 20:18 猪突猛进!!! 阅读(172) 评论(0) 推荐(0)
摘要:万恶的打表#include<stdio.h> #include<math.h> #include<stdlib.h> #include<string.h> #define INF 0x3f3f3f #define max 600+50 int map[max][max],visit[max],low 阅读全文
posted @ 2016-08-24 20:16 猪突猛进!!! 阅读(211) 评论(0) 推荐(0)
摘要:同样的代码 每次交的结果都不一样#include<stdio.h> #include<string.h> #include<stdlib.h> #include<algorithm> #include<iostream> using namespace std; struct Node { int 阅读全文
posted @ 2016-08-24 20:13 猪突猛进!!! 阅读(172) 评论(0) 推荐(0)
摘要:Constructing Roads Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 20927 Accepted Submission(s): 阅读全文
posted @ 2016-08-23 17:08 猪突猛进!!! 阅读(215) 评论(0) 推荐(0)
摘要:大致的步骤 首先选取一个到集合最近的点 然后标记起在集合内部 然后更新最短距离 畅通工程再续 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 24 阅读全文
posted @ 2016-08-23 15:40 猪突猛进!!! 阅读(142) 评论(0) 推荐(0)