Problem Statement
给定一棵n个节点的树,要求找出两个最大的没有公共点的同构连通块。求这两个连通块的大小。
两个连通块A,B同构是指存在一组A的点编号集合到B的点编号集合的双射p,
使得如果A中的点u,v之间有一条边,那么B中的点p(u),p(v)之间也有一条边。
n <= 51.
Deer Only has recently shed his antlers.
He is now ashamed and wants to make fake ones until the real ones grow back.
Deer Only has found a tree with N vertices.
The vertices are numbered 0 through N-1.
You are given two int[]s a and b that contain N-1 integers each.
These arrays describe the edges of the tree:
for each i, the vertices a[i] and b[i] are connected by an edge.
Deer Only has decided to make his new antlers out of this tree.
The only operation he is able to do is to remove some edges from his tree, producing several smaller trees.
Then, he wants to take two of the newly created trees and attach them to his head.
The two antlers must be isomorphic, otherwise he will be unbalanced when running.
(See Notes for a formal definition of tree isomorphism.)
Return the maximal size of the deer's new fake antlers.
The size of an antler is defined as the number of vertices in it.
Note that the largest possible antlers may sometimes consist only of a single vertex (and no edges).