简单的二叉树
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
Background
袁学长在讲二叉树的时候提到了用前序序列和中序序列恢复二叉树,现在来检验一下大家有没有学会。
Description
这道题很简单,题目给出一个二叉树的前序序列和中序序列,你需要求出它的后序序列。
Format
Input
第一行输入一个整数 表示二叉树中点的个数。
接下来一行输入 个整数 表示二叉树的前序序列。
接下来一行输入 个整数 表示二叉树的中序序列。
Output
输入一行 个空格隔开的整数表示二叉树的后序序列。
Samples
11
1 2 4 7 5 8 9 3 6 10 11
7 4 2 8 5 9 1 3 10 6 11
7 4 8 9 5 2 10 11 6 3 1
Hint
- 和为由 到 的排列 ( 到 中每个数仅出现一次)。
- 输出结尾没有空格
2025五一结训赛(新大一)
- Status
- Done
- Rule
- ACM/ICPC
- Problem
- 10
- Start at
- 2025-5-5 8:10
- End at
- 2025-5-5 13:10
- Duration
- 5 hour(s)
- Host
- Partic.
- 5