#K79877. Merge Two Arrays into Sorted Order

    ID: 35406 Type: Default 1000ms 256MiB

Merge Two Arrays into Sorted Order

Merge Two Arrays into Sorted Order

You are given two arrays of integers. Your task is to merge the two arrays into a single sorted array in non-decreasing order.

The input provides the size of the first array and the elements of the first array, followed by the size of the second array and its elements. You are required to merge these arrays and then output the sorted array.

Note: If an array is empty, its size will be given as 0 and it will be followed by an empty line.

The sorted order is defined by the inequality \(a_1 \leq a_2 \leq \cdots \leq a_k\).

inputFormat

The input is read from stdin and has the following format:

n
A[0] A[1] ... A[n-1]
m
B[0] B[1] ... B[m-1]

Here, n is the number of elements in the first array, followed by a line containing n space-separated integers. Then, m is the number of elements in the second array, followed by a line containing m space-separated integers. If n or m is 0, the respective array line will be empty.

outputFormat

Print to stdout a single line of space-separated integers representing the merged and sorted array.

## sample
3
5 1 3
3
2 4 6
1 2 3 4 5 6

</p>