| Author: | Pavel Mesenev | Time limit: | 2 sec | |
| Input file: | Standard input | Memory limit: | 256 Mb | |
| Output file: | Standard output |
You are given k arrays, each already sorted in non-decreasing order (an array may be empty). Output all elements from all arrays, merged into one non-decreasing sequence.
The first line contains one integer k. Then, for each of the k arrays: one line with its length m, followed by a line with m space-separated integers (the line may be empty if m = 0).
Print all elements, merged and sorted, space-separated on one line (an empty line if there are none).
1 ≤ k ≤ 2 ⋅ 105
0 ≤ total number of elements across all arrays ≤ 2 ⋅ 105
− 109 ≤ element ≤ 109
| No. | Standard input | Standard output |
|---|---|---|
| 1 |
|
|
| 2 |
|
|