cswork / OAOpen practice workspace

MetaOA #20

Merge Three Sorted Arrays

Estimated EasyJudge-ready

Topics (AI-labelled)Two PointersIn-place Arrays

Merge three non-decreasing integer arrays into one strictly increasing array, keeping each value only once. Input arrays may be empty.

Input

This site's standard input scale: first n m k (each 0..100000); the next three lines are the three arrays (an empty array is an empty line), with values in −10⁹..10⁹, and each array is non-decreasing.

Output

Output the answer as described; separate multiple results with spaces in order, and output an empty line for an empty array.

Example 1

Input:

3 4 3
1 3 5
1 2 5 6
2 4 6

Output:

1 2 3 4 5 6

Example 2

Input:

0 3 2

0 0 1
1 2

Output:

0 1 2

Example 3

Input:

0 0 0



Output:

Example notes

Example 1: the distinct values across the three arrays are 1, 2, 3, 4, 5, 6; each is output once, in ascending order.

Editorial

Loading solution…