正文
增加 5 行删除 5 行
45 行未改动464748495051525354555657585937 行未改动97989910010110210310410511 行未改动11711811912012112212312412512610 行未改动45 行未改动printf("\n");}inline void dfs(int u, int fa, int col){from[u] = fa, dep[u] = dep[fa] + 1, vis[u] = col;int yyc = 0;for(auto v : to[u])if(v ^ fa && du[v] % 3 == 2){if(vis[v] && (!yyc || dep[v] > dep[yyc])) yyc = v;}if(yyc && !cir){cir = 1;int tp = u;while(tp ^ yyc) ans.push_back(tp), tp = from[tp];37 行未改动if(!ct[0].empty()) ans.push_back(ct[0][0]);else if(ct[1].size() >= 2){int x = ct[1][0], y = 0;queue<int> q;q.push(x), vis[x] = 1;while(!q.empty()){int u = q.front(); q.pop();for(auto v : to[u])if(!vis[v]){11 行未改动}else{for(auto i : ct[2]) if(!vis[i]) dfs(i, 0, i);if(!cir){int mid = ct[1][0];ans.push_back(mid), Vis[mid] = 1;for(auto i : to[mid]) Leaf[i] = 1, lby[vis[i]].push_back(i);int cnt = 0;for(int i = 1; i <= n; ++i)if(!lby[i].empty()){10 行未改动45 行未改动464748495051525354555657585937 行未改动97989910010110210310410511 行未改动11711811912012112212312412512610 行未改动45 行未改动printf("\n");}inline void dfs(int u, int fa, int col){from[u] = fa, dep[u] = dep[fa] + 1, vis[u] = col;int yyc = 0;for(auto v : to[u])if(v ^ fa && du[v] % 3 == 2){if(vis[v] && (!yyc || dep[v] > dep[yyc])) yyc = v;}if(yyc && !cir){cir = 1;int tp = u;while(tp ^ yyc) ans.push_back(tp), tp = from[tp];37 行未改动if(!ct[0].empty()) ans.push_back(ct[0][0]);else if(ct[1].size() >= 2){int x = ct[1][0], y = 0;queue<int> q;q.push(x), vis[x] = 1;while(!q.empty()){int u = q.front(); q.pop();for(auto v : to[u])if(!vis[v]){11 行未改动}else{for(auto i : ct[2]) if(!vis[i]) dfs(i, 0, i);if(!cir){int mid = ct[1][0];ans.push_back(mid), Vis[mid] = 1;for(auto i : to[mid]) Leaf[i] = 1, lby[vis[i]].push_back(i);int cnt = 0;for(int i = 1; i <= n; ++i)if(!lby[i].empty()){10 行未改动