随笔分类 -  并查集

hdu 1878欧拉回路
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1878View Code 1 #include<stdio.h> 2 #include<string.h> 3 int n,m; 4 int root[1002]; 5 int from[1002]; 6 int to[1002]; 7 int find(int x) 8 { 9 int res=x;10 while(x!=root[x])11 x=root[x];12 return x;13 }14 15 void merge(int x,int y)16 {17 ... 阅读全文

posted @ 2012-09-02 20:30 仁者无敌8勇者无惧 阅读(125) 评论(0) 推荐(0)

hdu 1162Eddy's picture
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1162Eddy's pictureTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4199Accepted Submission(s): 2061Problem DescriptionEddy begins to like painting pictures recently ,he is sure of himself to become a pai 阅读全文

posted @ 2012-08-14 10:43 仁者无敌8勇者无惧 阅读(231) 评论(0) 推荐(0)

hdu 3371Connect the Cities
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=3371View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 int root[510]; 5 struct Node 6 { 7 int start,end; 8 int len; 9 }node[25010];10 int cmp(const void*x,const void*y)11 {12 return (*(Node*)x).len-(*(Node*)y).len;13 阅读全文

posted @ 2012-08-13 21:44 仁者无敌8勇者无惧 阅读(128) 评论(0) 推荐(0)

hdu 并查集专题
摘要:http://acm.hdu.edu.cn/diy/contest_show.php?cid=165621.How Many TablesView Code 1 #include<stdio.h> 2 int root[1001]; 3 int find(int x) 4 { 5 int r=x; 6 while(r!=root[r]) 7 r=root[r]; 8 int i=x,j; 9 /*10 while(i!=r)11 {12 j=root[i];13 root[i]=r;14 ... 阅读全文

posted @ 2012-08-11 16:47 仁者无敌8勇者无惧 阅读(234) 评论(0) 推荐(0)

hdu 1863畅通工程
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1863畅通工程Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 9952Accepted Submission(s): 3929Problem Description省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可)。经过调查评估,得到的统计表中列出了有可能建设公路的若干条道路的成本。现请你编 阅读全文

posted @ 2012-08-11 16:23 仁者无敌8勇者无惧 阅读(154) 评论(0) 推荐(0)

hdu 2473Junk-Mail Filter
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2473Junk-Mail FilterTime Limit: 15000/8000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3948Accepted Submission(s): 1197Problem DescriptionRecognizing junk mails is a tough task. The method used here consists of two steps:1) 阅读全文

posted @ 2012-08-11 13:21 仁者无敌8勇者无惧 阅读(234) 评论(0) 推荐(0)

并查集
摘要:http://hi.baidu.com/344847199/blog/item/79092f1fec9527d2a78669a5.html 阅读全文

posted @ 2012-08-10 16:56 仁者无敌8勇者无惧 阅读(109) 评论(0) 推荐(0)

导航