← 返回 meta 的题目列表Merge Three Sorted Arrays and Remove Duplicates
类型:online_judge
Given three nondecreasing integer arrays a, b, and c, merge them into one nondecreasing array while removing all duplicates.
Requirements:
Do not concatenate all elements and sort the combined array.
Every value may appear at most once in the output.
Let the input sizes be n1, n2, and n3; use extra space proportional to the output size whenever possible.
Input Format
Three lines. Each line starts with an array length followed by its elements.
Output Format
Print the sorted, deduplicated result separated by spaces.
Example
Input
4 1 2 2 8
3 2 3 8
5 0 1 3 3 9
Output
0 1 2 3 8 9
Constraints
0 <= n1, n2, n3 <= 2 * 10^5
Values fit in signed 32-bit integers.
Example
Input
4 1 2 2 8
3 2 3 8
5 0 1 3 3 9
Output
0 1 2 3 8 9