시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 512 MB | 8 | 5 | 4 | 66.667% |
There are $n$ segments on a line. You should place some points onto this line so that:
The first line contains an integer $n$ ($1 \le n \le 200000$) --- the number of segments.
Each of the next $n$ lines contains two integers $L_i$ and $R_i$ ($L_i < R_i$) --- the endpoints of the $i$-th segment.
For convenience, all endpoints of all segments are even numbers from $0$ to $4n - 2$.
If it's impossible to place points in a required way, output "-1
".
Otherwise, in the first line output an integer $m$ --- the number of points that should be placed onto the line.
In the next line, output $m$ distinct integers from $0$ to $4n - 2$ --- the coordinates of the points.
You don't have to minimize the number of points. If there are several possible solutions, output any of them.
3 0 10 2 4 6 8
-1
2 0 6 2 4
1 4
3 0 2 2 4 4 6
3 1 3 6