#include #include #include using namespace std; using ll = long long; struct UnionFind{ vector par, siz, rank; UnionFind(int n) : par(n, -1), siz(n, 1), rank(n, 1) {} //コンストラクタ //根を求めるやつ int root(int x){ if(par[x]==-1) return x; else return par[x]=root(par[x]); } //xを含むグループとyを含むグループとを併合する bool unite(int x, int y){ x=root(x); y=root(y); if(x==y) return false; if(rank[x]> n >> m; vector deg(n); UnionFind uf(n); for(int i=0; i> u >> v; deg[u]++, deg[v]++; uf.unite(u, v); } int r=-1; int odd=0; for(int i=0; i