3287 - EE2310Quiz 11 Scoreboard

Time

2025/12/08 11:00:00 2025/12/08 12:50:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
14874 Build binary tree from inorder and postorder
14875 Date format converter

14874 - Build binary tree from inorder and postorder   

Description

You are given two sequences representing the inorder traversal and postorder traversal of a binary tree consisting of n unique nodes.

Your task is to reconstruct the unique binary tree defined by these traversals and output its preorder traversal.

The first input line contains the inorder traversal (from left subtree → root → right subtree).

The second input line contains the postorder traversal (from left subtree → right subtree → root).

Compute and output the preorder traversal (root → left subtree → right subtree) of the constructed binary tree.

sample 1:

inorder    : 2 1 3

postorder: 2 3 1

preorder  : 1 2 3

sample 2:

inorder    : 4 2 5 1 3

postorder: 4 5 2 3 1

preorder  : 1 2 4 5 3

Input

Two lines of integers, each line consists of n unique nodes, where 1 <= n <= 100.

First line: inorder traversal

Second line: postorder traversal

Both sequences contain exactly the same set of values with no duplicates.

Output

One line of integers: preorder traversal of the constructed binary tree.

Ensure that the output, including formatting, exactly matches the provided samples.

Sample Input  Download

Sample Output  Download

Tags

11410EE 231002



Discuss




14875 - Date format converter   

Description

This program reads a date represented by three integers: year, month, and day, followed by a formatting instruction.

The formatting instruction can be one of the following three types:

Instruction
Output order
MMDDYY
month/day/year
DDMMYY
day/month/year
YYMMDD
year/month/day

 

The program must output the date in the specified order.

The year must be printed using four digits, and both month and day must be printed using two digits, padded with leading zeros if necessary.

A slash / should be placed between the components.

Input

The first line of input:

year month day

The second line of input:

A string representing the formatting instruction (one of: MMDDYY, DDMMYY, YYMMDD)

Output

One formatted date string based on the given instruction.

Ensure that the output formatting exactly matches the samples provided.

Sample Input  Download

Sample Output  Download

Tags

11410EE 231002



Discuss