1411 - I2P (II) 2018_Yang_Lab2 Scoreboard

Time

2018/03/23 13:30:00 2018/03/23 15:10:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
11357 Josephus Problem
11846 Construct a binary tree

11357 - Josephus Problem   

Description

Based on the original Josephus Problem introduced in class, this problem adds other rules.

1. After killing a person, it will change the direction of counting.

2. After killing a person, the counting number will increase the same value.

For example, there are 5 people, numbered 1 to 5, in a circle

and arranged in clockwise.  The step to kill is 3.

1, 2, 3 (kill 3, change the direction to counter-clockwise)

2, 1, 5, 4, 2, 1 (kill 1, change the direction to clockwise)

2, 4, 5, 2, 4, 5, 2, 4, 5 (kill 5, change the direction to counter-clockwise)

...

 

Input

The input has two positive integers, n (the number of people) and m (the number that will increase every time).

Output

The output is the order of people that were killed.

Sample Input  Download

Sample Output  Download

Partial Judge Code

11357.c

Partial Judge Header

11357.h

Tags




Discuss




11846 - Construct a binary tree   

Description

Niflheimr is tired of constructing huge binary trees, and overwhelmed by time complexity and optimization. This time he wants to take a break.

The professor asks him to construct binary trees again QAQ. Fortunately, the problem size has reduced, thus the optimization technique in Problem 11833 (a.k.a. your homework) is no longer needed in this problem.

 

All you need to do is implement the build() and postorder() function!

Remember #include "function.h" and choose C compiler!

Input

*Since this problem is partial judge and the input has been handled, you don't need to care about input format.

 

The first line of input contains a integer N, indicating the number of nodes on the tree.
The second line contains N distinct numbers, which is the in-order traversal seuqence of the binary tree.
The third line contains N distinct numbers, which is the pre-order traversal sequence of the binary tree.

It is guaranteed that:

  • 1 ≤ N ≤ 3*104
  • For all x being the number on the binary tree, 1 ≤ x ≤ N.

Output

*Since this problem is partial judge and the output has been handled, you don't need to care about output format.
 

Print out the post-order traversal sequence of the binary tree.
There is a white space after each number (including the last one). For example, [1 2 3 4 ].
Remember to print a '\n' at the end of the output.

Sample Input  Download

Sample Output  Download

Partial Judge Code

11846.c

Partial Judge Header

11846.h

Tags




Discuss