01 2012 档案
摘要:1232的连接:http://acm.hdu.edu.cn/showproblem.php?pid=1232#include <iostream>#include <cstdio>#define MAX 1005using namespace std;int father[MAX],rank[MAX];int N,M;void make_set(){ for(int i=1;i<=N;i++){ father[i]=i; }}int find_set(int x){ if(x!=father[x]){ father[x]=find_set(father[...
阅读全文
摘要:主要参考出处:http://clemily.blog.163.com/blog/static/1680500342011431102234244/ 感谢他(她)的优秀文章。我是参考学习的。SWUST OJ 1813 灾后城市道路规划问题Description2008年5月12日的汶川地震给绵阳带来重大的损失,在全国人名的努力下,经过近三年的灾后重建。灾区的生活终于又恢复了平静,美丽的汶川有出现在了世人的面前,但是随着经济的恢复,绵阳的交通出现了很大的问题,特别是灾区的交通。以前留下的一些旧的公路和现在新修的一些公路错杂交错。让人们的出行很不方面。作为绵阳道路规划的负责人,Bearboy,想要.
阅读全文
摘要:#include<iostream>using namespace std;int father[50005];int rank[50005];int maxNum;void make_set(int x){ father[x]=x; rank[x]=1;}int find_set(int x){ if(x!=father[x]) { father[x]=find_set(father[x]); } return father[x];}void Union(int x,int y){ x=find_set(x); y=...
阅读全文