#P8023. [ONTAK2015] Tasowanie
[ONTAK2015] Tasowanie
Problem Description
Given two digit sequences and , merge and with a two-way merge to obtain a new digit sequence . Find the lexicographically smallest .
Input Format
The first line contains an integer , the length of .
The second line contains integers, representing .
The third line contains an integer , the length of .
The fourth line contains integers, representing .
Output Format
Output one line with positive integers, representing the lexicographically smallest .
6
1 2 3 1 2 4
7
1 2 2 1 3 4 3
1 1 2 2 1 2 3 1 2 3 4 3 4
Hint
For of the testdata, , and each number in and is a positive integer not exceeding .
- On 2023.9.10, two sets of hack testdata were added.
Translated by ChatGPT 5