
并查集
77cc
这个作者很懒,什么都没留下…
展开
-
Is It A Tree?
A tree is a well-known data structure that is either empty (null, void, nothing) or is a set of one or more nodes connected by directed edges between nodes satisfying the following properties. There原创 2017-07-18 19:05:04 · 377 阅读 · 0 评论 -
POJ 1703
Find them, Catch themTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 46068 Accepted: 14176DescriptionThe police office in Tadu City decides to say ends原创 2017-07-19 20:33:09 · 326 阅读 · 0 评论 -
并查集与带权并查集(转)
转自Chris_zzj的博客!并查集并查集是一个很高效算法,理解起来也很简单,写起来更简单。①fat[i] = i;②找到一个点的祖先[cpp] view plain copyint findfat(int x) { if(fat[x] == x) return x;转载 2017-07-19 10:36:13 · 1434 阅读 · 0 评论 -
生动形象的描述并查集(转)
并查集是我暑假从高手那里学到的一招,觉得真是太精妙的设计了。以前我无法解决的一类问题竟然可以用如此简单高效的方法搞定。不分享出来真是对不起party了。(party:我靠,关我嘛事啊?我跟你很熟么?)来看一个实例,HDU1232畅通工程首先在地图上给你若干个城镇,这些城镇都可以看作点,然后告诉你哪些对城镇之间是有道路直接相连的。最后要解决的是整幅图的连通性问题。比如随意给你两个转载 2017-07-19 10:38:52 · 457 阅读 · 0 评论