시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 (추가 시간 없음) 1024 MB333100.000%

문제

There are $N$ robots numbered from $1$ through $N$ and $N$ antennas numbered from $1$ through $N$ in a straight line. The coordinate of the robot $i$ is $a_i$ and the coordinate of the antenna $i$ is $b_i$. All coordinates are distinct.

Currently, all antennas are inactive. You are going to activate them one by one. When you activate an antenna, the nearest robot (if two robots are closest to it, only the left one) moves to the antenna and explodes along with it.

Find an order to activate antennas so that the total distance of robots' moves is minimum possible.

입력

Input is given from Standard Input in the following format:

$N$

$a_1$ $a_2$ $\dots$ $a_N$

$b_1$ $b_2$ $\dots$ $b_N$

출력

Print the answer in the following format:

$X$

$p_1$ $p_2$ $\dots$ $p_N$

Here, $X$ must be a minimum total distance, and $p_i$ is the index of the antenna that you activate in the $i$-th.

If there are multiple solutions, you can print any of them.

제한

  • $1 \leq N \leq 2 \times 10^5$
  • $0 \leq a_1 < a_2 < \dots < a_N \leq 10^9$
  • $0 \leq b_1 < b_2 < \dots < b_N \leq 10^9$
  • $a_1, a_2, \dots, a_N, b_1, b_2, \dots, b_N$ are all distinct.
  • All values in input are integers.

예제 입력 1

3
1 2 3
11 12 13

예제 출력 1

30
3 2 1