
并査集
破晓aa
这个作者很懒,什么都没留下…
展开
-
并查集
并查集是我暑假从高手那里学到的一招,觉得真是太精妙的设计了。以前我无法解决的一类问题竟然可以用如此简单高效的方法搞定。 来看一个实例,杭电1232畅通工程 首先在地图上给你若干个城镇,这些城镇都可以看作点,然后告诉你哪些对城镇之间是有道路直接相连的。最后要解决的是整幅图的连通性问题。比如随意给你两个点,让你判断它们是否连通,或者问你整幅图一共有几个连通分支,也就是被分成了几个互相独立的块。像畅...转载 2018-06-04 15:50:34 · 112 阅读 · 0 评论 -
Parity game POJ - 1733(并查集 + 离散化)
Now and then you play the following game with your friend. Your friend writes down a sequence consisting of zeroes and ones. You choose a continuous subsequence (for example the subsequence from th...原创 2018-11-20 16:21:06 · 176 阅读 · 0 评论 -
A - Wireless Network (并查集)
An earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the lap computers, but an unexpected aftershock attacked, all computers in the n...原创 2018-06-14 20:19:20 · 201 阅读 · 0 评论 -
Number of Connected Components UVALive - 7638(并查集 + 唯一分解)
Given N nodes, each node is labeled with an integer between 1 and 106 (inclusive and labels are not necessarily distinct). Two nodes have an edge between them, if and only if the GCD (Greatest Common ...原创 2018-12-18 08:41:32 · 263 阅读 · 0 评论