随笔分类 - 并查集
摘要:https://www.acwing.com/problem/content/description/1599/ #include <iostream> #include <cstring> #include <algorithm> #include <vector> using namespace
阅读全文
摘要:https://www.acwing.com/problem/content/1606/ #include <iostream> #include <algorithm> #include <vector> using namespace std; const int N = 10010; int
阅读全文
摘要:https://www.acwing.com/problem/content/1487/ 并查集维护连通块的写法 #include <iostream> #include <cstring> using namespace std; const int N = 1010, M = 500010; i
阅读全文
摘要:https://www.acwing.com/problem/content/1520/ 思路: 先找到在一个团伙中的人(可以用树的dfs来做,也可以用并查集来做),然后遍历每一个合法的集合,找到里面的头目。 并查集的做法 #include <iostream> #include <unordere
阅读全文

浙公网安备 33010602011771号