Codeforces Round #603 (Div. 2) D Secret Passwords (并查集)
题目链接#includeconstintmaxn=100;intfa[maxn],ans,n;chars[maxn];boolvis[maxn];inlineintfind(intx){returnfa[x]==x?x:fa[x]=find(fa[x]);}inlinevoidmerge(intx,inty){x=find(x),y=find(y);if(x!=y)fa[x]=y;return;}