#include using namespace std; #define int long long struct Unionfind{ vector par, siz; //初期化 Unionfind(int n) : par(n,-1) , siz(n,1) {} int root(int x) { if(par[x] == -1) return x; else return par[x] = root(par[x]); } bool issame(int x,int y) { return root(x) == root(y); } bool unite(int x, int y){ x = root(x); y = root(y); if(x == y) return false; if(siz[x] < siz[y]) swap(x,y); par[y] = x; siz[x] += siz[y]; return true; } int size(int x) { return siz[root(x)]; } }; signed main(){ int N,M,K; cin>>N>>M>>K; vector S(K); for(int i=0;i>S[i]; S[i]--; } vector> G(N); for(int i=0;i>a>>b; a--; b--; G[a].push_back(b); G[b].push_back(a); } Unionfind uf(N*N); for(int i=0;i