시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB128807461.667%

문제

Have you ever heard of Just Odd Inventions, Ltd.? This company is known for their “just odd inventions.” We call it JOI, Ltd. in this problem. JOI, Ltd. has invented its newest product “Just Long Neckties”. There are N + 1 types of neckties, numbered 1 to N + 1. The length of the i-th necktie (1 ≤ i ≤ N + 1) is Ai.

The company gathered their employees to hold a try-on party. N employees participate in the party, and the j-th employee (1 ≤ j ≤ N) initially wears a necktie of length Bj.

The try-on party is held following this procedure:

  1. CEO of JOI, Ltd. chooses a necktie, which is not used at the party.
  2. Then, each employee chooses one of the remaining neckties to try on. No two employees choose the same necktie.
  3. Finally, each employee takes off the necktie which (s)he initially wears and puts the selected necktie on.

If an employee initially wearing a necktie of length b tries a necktie of length a, (s)he feels strangeness of max{a − b, 0}. The oddity of the try-on party is defined as the maximum strangeness among the employees.

We also define Ck as the minimum oddity of the try-on party if CEO of JOI, Ltd. chooses the k-th necktie.

Write a program which, given the lengths of the neckties used at the party and the neckties each employee initially wears, calculates the values of C1,C2, . . . ,CN+1.

입력

Read the following data from the standard input. Given values are all integers.

N
A1 . . . AN+1
B1 . . . BN

출력

Write one line to the standard output. The output should contain the values of C1,C2, . . . ,CN+1, separated by a space.

제한

  • 1 ≤ N ≤ 200 000.
  • 1 ≤ Ai ≤ 1 000 000 000 (1 ≤ i ≤ N + 1).
  • 1 ≤ Bj ≤ 1 000 000 000 (1 ≤ j ≤ N).

서브태스크

번호배점제한
11

N ≤ 10.

28

N ≤ 2000.

391

No additional constraints.

예제 입력 1

3
4 3 7 6
2 6 4

예제 출력 1

2 2 1 1

Here is an example of a try-on party:

  • CEO of JOI, Ltd. chooses the 4th necktie. This necktie is not used in the party.
  • The employee 1 chooses the 1st necktie, the employee 2 chooses the 2nd necktie, the employee 3 chooses the 3rd necktie.
  • Each employee tries the necktie they choose on.

In this case, strangeness of each employee is 2, 0, 3 in order. Therefore, the oddity of the party is 3. It is possible to decrease the oddity to 1 if the employees choose different neckties. One of the example is:

  • CEO of JOI, Ltd. chooses the 4th necktie. This necktie is not used in the party.
  • The employee 1 chooses the 2nd necktie, the employee 2 chooses the 3rd necktie, the employee 3 chooses the 1st necktie.
  • Each employee tries the necktie they choose on.

In this case, strangeness of each employee is 1, 1, 0 in order. Therefore, the oddity of the party is 1. This is the minimum possible oddity when CEO of JOI, Ltd. chooses the 4th necktie, so C4 = 1.

예제 입력 2

5
4 7 9 10 11 12
3 5 7 9 11

예제 출력 2

4 4 3 2 2 2

채점 및 기타 정보

  • 예제는 채점하지 않는다.