求连通块个数 (并查集思路)

  今天复习DFS时做到连通块的题,突然发现并查集也可以搞 我就试试没想到还真能弄。。。。 / / /   #include <iostream> #include <string> using namespace std; const int M=10000+100; string s[110]; int fa[M]; int get(int x) { if(fa[x]==x)
相关文章
相关标签/搜索