并查集
Lngxling
这个作者很懒,什么都没留下…
展开
-
CodeForces - 357C Knight Tournament ——并查集优化
C. Knight Tournamenttime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputHooray! Berl II, the king of Berland i原创 2017-09-13 11:37:53 · 280 阅读 · 0 评论 -
UVA - 11987 Almost Union-Find ——删除元素的并查集
I hope you know the beautiful Union-Find structure. In this problem, you’re to implement somethingsimilar, but not identical.The data structure you need to write is also a collection of disjoint s原创 2017-09-11 23:10:59 · 244 阅读 · 0 评论 -
CodeForces - 505B Mr. Kitayuta's Colorful Graph —— 多维并查集
B. Mr. Kitayuta's Colorful Graphtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputMr. Kitayuta has just bough原创 2017-09-20 21:26:19 · 210 阅读 · 0 评论 -
HDU - 1213 How Many Tables ——并查集
How Many TablesTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 34088 Accepted Submission(s): 17022Problem DescriptionToday is原创 2017-09-12 21:54:19 · 184 阅读 · 0 评论 -
POJ - 1611 The Suspects ——并查集
The SuspectsTime Limit: 1000MS Memory Limit: 20000KTotal Submissions: 42212 Accepted: 20362DescriptionSevere acute respiratory syndrome (SARS), an atypical pneu原创 2017-09-12 21:09:24 · 220 阅读 · 0 评论 -
POJ - 2236 Wireless Network ——并查集
Wireless NetworkTime Limit: 10000MS Memory Limit: 65536KTotal Submissions: 30641 Accepted: 12741DescriptionAn earthquake takes place in Southeast Asia. The ACM原创 2017-09-11 23:41:46 · 184 阅读 · 0 评论 -
HDU - 3974 Assign the task —— 并查集
Assign the taskTime Limit: 15000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3624 Accepted Submission(s): 1498Problem DescriptionThere is原创 2017-09-19 23:02:04 · 326 阅读 · 0 评论 -
CodeForces - 371D Vessels——并查集
D. Vesselstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere is a system of n vessels arranged one abov原创 2017-09-11 17:26:34 · 394 阅读 · 0 评论 -
并查集
并查集—常用来解决有关求连通分支的问题思想:用一个pre[n]数组将各个点联系起来函数:find(int x) join(int x,int y)int find (int x)//递归定义 { return pre[x]==xx:pre[x]=find(pre[x]);}int find(int x)//通常定义 { int r=x; wh原创 2017-07-18 21:39:46 · 207 阅读 · 0 评论 -
二维并查集——CodeForces - 505B Mr. Kitayuta's Colorful Graph
原题链接CodeForces - 505B Mr. Kitayuta’s Colorful Graph 一个无向图包含n个点m条边,顶点编号从1到n。 对于每条边有颜色ci, 连接着顶点 ai 和 b i. 下面有q个询问.每条询问有两个整数 — ui 和 vi.找到满足下面条件的颜色个数: 同一种颜色的路径连接顶点 ui 和 顶点 vi Input 第一行是两个整数 — n an原创 2017-08-11 20:43:20 · 423 阅读 · 0 评论 -
poj1703 Find them, Catch them——带权并查集
Language:DefaultFind them, Catch themTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 47233Accepted: 14548DescriptionThe police office in Tadu City decides to say ends to the chaos, as launch a原创 2017-09-07 17:38:11 · 240 阅读 · 0 评论 -
poj 1182 食物链 —— 种类并查集
食物链Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 78828 Accepted: 23486Description动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N编号。每个动原创 2017-11-18 20:04:58 · 212 阅读 · 0 评论