EITREORD - Postorder

Xem dạng PDF

Gửi bài giải

Điểm: 1,00 (OI)
Giới hạn thời gian: 1.0s
Giới hạn bộ nhớ: 256M
Input: stdin
Output: stdout

Nguồn bài:
Hà Minh Ngọc
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch

Given the pre order traversal and in-order traversal of a binary treee. Build and print the post-order traveral of the given tree.

Input

  • The first line contains: ~N~ as the number of vertices ~(N \le 80 000)~.
  • The second line contains: ~N~ numbers, which are preorder browsing lists.
  • The third line contains: ~N~ numbers as the inorder browse list.

Output

  • Print out the postorder traversal .

Example Input

6
0 4 2 3 5 1
4 0 5 3 2 1

Example Output

4 5 3 1 2 0

Note


Bình luận

Hãy đọc nội quy trước khi bình luận.


Không có bình luận tại thời điểm này.