#abc256d. D - Union of Interval
D - Union of Interval
Score : points
问题描述
对于实数 和 ,我们用 表示所有大于等于 且小于 的实数集合。这样的集合被称为右半开区间。
现在给你 个右半开区间 。设它们的并集为 。请将集合 表示为尽可能少的右半开区间的并集。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
For real numbers and , let us denote by the set of real numbers greater than or equal to and less than . Such a set is called a right half-open interval.
You are given right half-open intervals . Let be their union. Represent as a union of the minimum number of right half-open intervals.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Let be the minimum number of right half-open intervals needed to represent as their union. Print lines containing such right half-open intervals in ascending order of , as follows:
Sample Input 1
3
10 20
20 30
40 50
Sample Output 1
10 30
40 50
The union of the three right half-open intervals equals the union of two right half-open intervals .
Sample Input 2
3
10 40
30 60
20 50
Sample Output 2
10 60
The union of the three right half-open intervals equals the union of one right half-open interval .
update @ 2024/3/10 10:53:39