Problem 872
Recursive Tree
A sequence of rooted trees
The sequence starts at
For
- Trace a path from the root of
to a leaf by following the largest-numbered child at each node. - Remove all edges along the traced path, disconnecting all nodes along it from their parents.
- Connect all orphaned nodes directly to a new node numbered
, which becomes the root of .
For example, the following figure shows

Let
Find
递归树
递归构造一个有根树序列
序列的第一项为
对于
- 从
的根节点出发,不断沿编号最大的子节点移动,直至到达叶节点,并记录相应的路径。 - 移除路径上的所有边,使路径上的节点与其父节点分离。
- 将所有被分离出的节点连接到一个新的、编号为
的节点,并将其作为 的根节点。
例如,下图展示了

记
求
Gitalking ...