voidclear(){ O = 0; for (int i = 0; i <= n; ++i) a[i] = 0; } voidinsert(ull v){ for (int i = n; ~i; --i) { if (!(v >> i & 1)) continue; if (!a[i]) { a[i] = v; break; } v ^= a[i]; } O |= !v; } } S;
int n, m, q;
structEdge { int u, v; ull w; } e[maxm]; bool vis[maxm];
int fa[maxn]; voidinit_fa(int n){ for (int i = 1; i <= n; ++i) fa[i] = i; } intfind(int x){ return fa[x] == x ? x : fa[x] = find(fa[x]); } inlineboolmerge(int x, int y){ x = find(x); y = find(y); if (x == y) return0; return fa[x] = y, 1; }
vector<pair<int, int>> G[maxn]; ull d[maxn]; voiddfs(int u, int fa){ for (auto [v, k] : G[u]) { if (v == fa) continue; dfs(v, u); d[u] ^= d[v]; e[k].w = d[v]; } }