
最小生成树
wsxsd94
这个作者很懒,什么都没留下…
展开
-
Hdu1863 - 畅通工程 - 最小生成树
#include#includeusing namespace std;int p[10000];struct tree{ int st,ed,va;}road[10000];int cmp(tree a,tree b){ return a.va<b.va;}int find(int n){ if(p[n]!=n) { p[n]=find(p[n]); } r原创 2014-07-27 14:48:55 · 425 阅读 · 0 评论 -
POJ1258 - Agri-Net - 最小生成树
#include#includeusing namespace std;int p[1005];struct R{ int st,ed,l;}road[1000050];int cmp(R a,R b){ return a.l==b.l?a.st<b.st:a.l<b.l;}int find(int n){ if(n!=p[n]) { p[n]=find(p[n]原创 2014-07-27 15:26:27 · 440 阅读 · 0 评论 -
Hdu1879 - 继续畅通工程 - 最小生成树
#include#include#includeusing namespace std;int p[105];struct R{ int st,ed,len,time;}road[10000];int find(int n){ return p[n]==n?p[n]:find(p[n]);}int cmp(R a,R b){ return a.len<b.len;}原创 2014-07-27 15:21:48 · 440 阅读 · 0 评论 -
Hdu1233 - 还是畅通工程 - 最小生成树
#include#include#includeusing namespace std;int p[105];struct R{ int st,ed,len;}road[10000];int find(int n){ return p[n]==n?p[n]:find(p[n]);}int cmp(R a,R b){ return a.len<b.len;}int原创 2014-07-27 15:14:13 · 438 阅读 · 0 评论 -
Hdu1102 - Constructing Roads - 最小生成树
#include#includeusing namespace std;int p[1005];struct R{ int st,ed,l;}road[1000050];int cmp(R a,R b){ return a.l==b.l?a.st<b.st:a.l<b.l;}int find(int n){ if(n!=p[n]) { p[n]=find(p[n]原创 2014-07-27 14:56:24 · 396 阅读 · 0 评论 -
Hdu1875 - 畅通工程再续 - 最小生成树
#include#includeusing namespace std;#includestruct edge{ int st,ed; double va;}num1[10005];struct point { int x,y;}num2[200];int p[200];int find(int n){ if(p[n]!=n) { p[n]=find(p[n]原创 2014-07-27 14:51:10 · 466 阅读 · 0 评论