
ACM 并查集 最小生成树
文章平均质量分 50
huixisheng
无所谓结果如何,只要一直坚持并努力就好!!
展开
-
小希的迷宫 hdu 1272
http://acm.hdu.edu.cn/showproblem.php?pid=1272#include// 好奇怪,为何我开始写的不行?? #include // 1 要求无回路 2 只有一棵树 #includeusing namespace std;const int MAX=100001;int set[MAX];bool mark[MAX];int find(int x){ i原创 2010-03-19 16:33:00 · 340 阅读 · 0 评论 -
还是畅通工程 hdu1233
http://acm.hdu.edu.cn/showproblem.php?pid=1233// 最小生成树的prim 算法,一开始知道原理,但是就是不知怎么把知道的转换成计算机语言,鉴戒了别人的算法后才可以写出 #include//2246861 2010-03-25 18:03:27 Accepted 1233 187MS 276K 971 B C++ 悔惜晟 #include usin原创 2010-03-23 11:48:00 · 347 阅读 · 0 评论 -
畅通工程再续 hdu1875
http://acm.hdu.edu.cn/showproblem.php?pid=1875#include//2235167 2010-03-23 16:21:03 Accepted 1875 312MS 352K 1567 B C++ 悔惜晟 #include //效率真的不高,算法还是有待给进,耗时主要在哪里呢?? #include#includeint aa[4951];using原创 2010-03-23 16:31:00 · 350 阅读 · 0 评论 -
Jungle Roads hdu1301
http://acm.hdu.edu.cn/showproblem.php?pid=1301#include//有是一个纯最小生成树的问题 ,一开始题目没有看了,看懂了,原来是这么简单的 #include//题意:输入一个n,n=0时break 在输入n-1行 每行输入大写字母表示村庄和组数k 在输入k行一个字母表示与这个村庄 #include //相连和一个数字表示修路的费用,输入连原创 2010-03-24 18:03:00 · 416 阅读 · 0 评论 -
Constructing Roads hdu1102
http://acm.hdu.edu.cn/showproblem.php?pid=1102// 是最小生成数的变题,一开始题目没有看仔细which means the road between village a and village b has been built.//这句话没有注意,看题目要仔细啊 #include//2242938 2010-03-24 20:03:34 Accep原创 2010-03-24 20:10:00 · 337 阅读 · 0 评论 -
Eddy's picture hdu1162
http://acm.hdu.edu.cn/showproblem.php?pid=1162#include//2235778 2010-03-23 18:04:30 Accepted 1162 0MS 352K 1248 B C++ 悔惜晟 #include//最小生成树的问题 Kruskal #include//#includeint aa[4951];using na原创 2010-03-23 18:12:00 · 412 阅读 · 0 评论 -
畅通工程 hdu1863
http://acm.hdu.edu.cn/showproblem.php?pid=1863 #include//又是最小生成树的问题#include#includeusing namespace std;int s[4951]; struct stu { int x; int y; int dis; }df[4951]; int cmp(stu a, stu b) { retu原创 2010-03-25 16:39:00 · 450 阅读 · 0 评论 -
How Many Tables hdu1213(并)
http://acm.hdu.edu.cn/showproblem.php?pid=1213#include//很简单的并查集 #includeint s[1002];//bool ss[1002]; int find(int a) { int r = a; while(r != s[r]) r = s[r]; return r; } void merge(int a, int原创 2010-03-25 17:10:00 · 341 阅读 · 0 评论 -
find the most comfortable road hdu 1598
<br />/* 对于这个问题我不想说什么,感觉ACM太神奇在这里检讨以下,好久没有写并查集都很生疏了 话说学的多也不能忘的快。。。在最短路的DIY中总感觉要用Dijsktra http://hi.baidu.com/yzy%D1%EE%D7%D3%D1%DC/blog/item/829095fd6c14b58eb901a0a3.html find the most comfortable road http://acm.hdu.edu.cn/showproblem.php?pid=15原创 2010-07-05 20:13:00 · 686 阅读 · 0 评论