File tree Expand file tree Collapse file tree 1 file changed +13
-17
lines changed
tests/library_checker_aizu_tests/graphs Expand file tree Collapse file tree 1 file changed +13
-17
lines changed Original file line number Diff line number Diff line change @@ -17,33 +17,29 @@ int main() {
1717 adj_e_id[u] += i;
1818 adj_e_id[v] += i;
1919 }
20-
2120 UF uf (n);
2221 vector<bool > seen (m);
2322 bcc_callback (adj, [&](const vi& nodes) {
2423 int cnt_edges = 0 ;
25- rep (i,0 ,sz (nodes)-1 )
26- for (int e_id : adj_e_id[nodes[i]])
27- if (!seen[e_id]) {
28- seen[e_id] = 1 ;
29- cnt_edges++;
30- }
24+ rep (i, 0 , sz (nodes) - 1 ) for (
25+ int e_id : adj_e_id[nodes[i]]) if (!seen[e_id]) {
26+ seen[e_id] = 1 ;
27+ cnt_edges++;
28+ }
3129 if (cnt_edges >= 2 )
3230 for (int v : nodes) uf.join (v, nodes[0 ]);
3331 });
34-
3532 vector<basic_string<int >> two_edge_ccs (n);
36- rep (i,0 , n) two_edge_ccs[uf.find (i)] += i;
33+ rep (i, 0 , n) two_edge_ccs[uf.find (i)] += i;
3734 int cnt_ccs = 0 ;
38- rep (i,0 , n) cnt_ccs += (!empty (two_edge_ccs[i]));
39- cout<< cnt_ccs<< ' \n ' ;
40- rep (i,0 , n) {
41- if (!empty (two_edge_ccs[i])) {
42- cout<< sz (two_edge_ccs[i])<< ' ' ;
43- for (int v: two_edge_ccs[i]) cout<<v<< ' ' ;
44- cout<< ' \n ' ;
35+ rep (i, 0 , n) cnt_ccs += (!empty (two_edge_ccs[i]));
36+ cout << cnt_ccs << ' \n ' ;
37+ rep (i, 0 , n) {
38+ if (!empty (two_edge_ccs[i])) {
39+ cout << sz (two_edge_ccs[i]) << ' ' ;
40+ for (int v : two_edge_ccs[i]) cout << v << ' ' ;
41+ cout << ' \n ' ;
4542 }
4643 }
47-
4844 return 0 ;
4945}
You can’t perform that action at this time.
0 commit comments