2021-01-30 D. Journey Quiz https://codeforces.com/contest/1476/problem/D AC https://codeforces.com/contest/1476/submission/105969483 解説 頂点倍化してUnion Find 下図を見れば分かるはず