Poklon
의견: 0
Mirko got a set of intervals for his birthday. There are many games he can play with them. In one of them, Mirko must find the longest sequence of distinct intervals such that each interval in the sequence is in the set and that each interval contains the one that follows in the sequence.
Write a program which finds one such longest sequence.
The first line of input contains the integer \(N\) (\(1 \le N \le 100\,000\)), the number of intervals in the set.
Each of the following \(N\) lines contains two integers \(A\) and \(B\) describing one interval (\(1 \le A < B \le 1\,000\,000\)).
Output the length \(K\) of the longest sequence on the first line.
Each of the following \(K\) lines should contain one element of the sequence, an interval in the same format it was given in the input.
| 서브태스크 | 점수 | 설명 |
|---|---|---|
Subtask 1 | 80점 |
3
3 4
2 5
1 63
1 6
2 5
3 45
10 30
20 40
30 50
10 60
30 403
10 60
30 50
30 406
1 4
1 5
1 6
1 7
2 5
3 55
1 7
1 6
1 5
2 5
3 5평가 및 의견
Poklon
아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.
풀이 제출
Poklon