1032: Handle intervals
[Creator : ]
Description
There is a set of N intervals, some of them might be overlapping each other, in this problem, please merge the overlapping intervals.
Input
the first line has one integer which is N
In the following N lines, each line has two integer X1 and X2 which stand for the interval [X1, X2] (X1 <X2]
1 <= N <= 1,000,000 , 1 <= Xi <= 100,000,000
In the following N lines, each line has two integer X1 and X2 which stand for the interval [X1, X2] (X1 <X2]
1 <= N <= 1,000,000 , 1 <= Xi <= 100,000,000
Output
the intervals which do not have overlapping in ascending order
Sample Input Copy
7
1 5
8 20
3 6
9 10
50 100
19 25
25 27
Sample Output Copy
1 6
8 27
50 100