|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||17||9||9||52.941%|
Let A be a permutation of 1, 2, 3 ..., 2*N - 1.
We define the prefix medians of A as an array B with N elements: where B[i] is the median of A, A, ..., A[2*i-1].
Note: The median of a list of M numbers (where M is odd) can be found by sorting the numbers and picking the middle one.
You are given N and the array B. You are asked to determine a permutation A whose prefix medians are precisely B.
The input file contains 2 lines. The first line contains one integer, N. The second line describes B: N integers, separated by space.
The output file should contain A: one line with 2*N-1 integers separated by space. If there are multiple permutations A leading to the same input array B, you may output any one. In all test data, there will always be at least one solution.
5 1 3 3 4 5
1 9 3 2 4 8 7 5 6