Problem
Input format
The program reads from standard input, in this order: - a natural number `n1`, followed by `n1` integers (the first sequence); - a natural number `n2`, followed by `n2` integers (the second sequence); - a natural number `n3`, followed by `n3` integers (the third sequence). - `1 <= n1, n2, n3 <= 1000` - `-1000000 <= values <= 1000000` - the sequences are sorted in ascending order and may contain duplicates
Output format
The program prints to standard output, on a single line, the `n1 + n2 + n3` values in ascending order, separated by single spaces, followed by a newline. When two minima are equal, the value from the first sequence is preferred, then the value from the second sequence.
Example
3 1 4 7 3 2 5 8 3 3 6 9
1 2 3 4 5 6 7 8 9
Stuck?
Use the Get Hint button in the action bar to reveal a guided hint.
💬 Discussion
Loading...No comments yet. Be the first to start the discussion!
Sample cases (from the problem)
Sample Case 1
3 1 4 7 3 2 5 8 3 3 6 9
1 2 3 4 5 6 7 8 9
Solve it your way first
Community solutions unlock after you submit a passing solution. Don't peek.
Ready to solve this challenge?
Create a free account to write code, submit solutions, and track your progress.