File tree Expand file tree Collapse file tree 1 file changed +5
-18
lines changed
tests/library_checker_aizu_tests/trees Expand file tree Collapse file tree 1 file changed +5
-18
lines changed Original file line number Diff line number Diff line change @@ -8,29 +8,16 @@ int main() {
88 cin.tie (0 )->sync_with_stdio (0 );
99 int n;
1010 cin >> n;
11- vector<vector<int >> adj_unrooted (2 * n);
12- vector<vector<int >> adj_rooted (n);
11+ vector<vector<int >> adj (n);
1312 for (int i = 1 ; i < n; i++) {
1413 int p;
1514 cin >> p;
16- adj_unrooted[p].push_back (i);
17- adj_unrooted[i].push_back (p);
18- adj_unrooted[p + n].push_back (i + n);
19- adj_unrooted[i + n].push_back (p + n);
20- adj_rooted[p].push_back (i);
15+ adj[p].push_back (i);
16+ adj[i].push_back (p);
2117 }
22- auto [num_distinct_subtrees, iso_id] =
23- subtree_iso (adj_unrooted);
24- auto [num_distinct_subtrees_rooted, iso_id_rooted] =
25- subtree_iso (adj_rooted);
26- assert (
27- num_distinct_subtrees == num_distinct_subtrees_rooted);
18+ auto [num_distinct_subtrees, iso_id] = subtree_iso (adj);
2819 cout << num_distinct_subtrees << ' \n ' ;
29- for (int i = 0 ; i < n; i++) {
30- cout << iso_id[i] << " " ;
31- assert (iso_id[i] == iso_id_rooted[i]);
32- assert (iso_id[i] == iso_id[i + n]);
33- }
20+ for (int i = 0 ; i < n; i++) cout << iso_id[i] << " " ;
3421 cout << ' \n ' ;
3522 return 0 ;
3623}
You can’t perform that action at this time.
0 commit comments