并查集
饮酒在风里
这个作者很懒,什么都没留下…
展开
-
图论-最小环问题(dfs+并查集)
题目描述有nn个同学(编号为11到nn)正在玩一个信息传递的游戏。在游戏里每人都有一个固定的信息传递对象,其中,编号为ii的同学的信息传递对象是编号为T_iTi的同学。游戏开始时,每人都只知道自己的生日。之后每一轮中,所有人会同时将自己当前所知的生日信息告诉各自的信息传递对象(注意:可能有人可以从若干人那里获取信息, 但是每人只会把信息告诉一个人,即自己的信息传递对象...原创 2019-10-14 13:30:45 · 572 阅读 · 0 评论 -
并查集&带权并查集&种类并查集 入门基础题
HDU 3038 How Many Answers Are Wrong(带权并查集)#include <iostream>#include <algorithm>#include <math.h>#include <vector>#include<cstdio>#include <cstring>#in...原创 2019-07-07 16:47:52 · 338 阅读 · 0 评论 -
并查集&最小生成树
Minimal Ratio Tree dfs+prim#include <iostream>#include <algorithm>#include <math.h>#include <vector>#include<cstdio>#include <cstring>#include <q...原创 2019-07-06 16:56:36 · 86 阅读 · 0 评论 -
HDU 4081 Qin Shi Huang's National Road System (次小生成树)prim
During the Warring States Period of ancient China(476 BC to 221 BC), there were seven kingdoms in China ---- they were Qi, Chu, Yan, Han, Zhao, Wei and Qin. Ying Zheng was the king of the kingdom Qin....原创 2019-07-07 20:58:06 · 258 阅读 · 0 评论