求連通塊個數(使用並查集)

並查集求連通塊個數的模板c++ #include<bits/stdc++.h> using namespace std; const int maxn = 1e5+5; vector<int>G[maxn]; bool isRoot[maxn] = {false}; int pre[maxn]; void init(int n){ for(int i = 0; i <= n; i+
相關文章
相關標籤/搜索