| UNICAMP Selection Contest 2023 |
|---|
| Finished |
Steve relaxing on his floating block Steve is conducting a physics experiment for the F129 course at UNICAMP. He measured how long it takes for him to fall from a tree and, after adding uncertainties, he has a confidence interval of $$$[l, r]$$$ for the gravity constant. Then, he repeated the experiment by throwing dirt, wood, bricks, and whatever he found on the way. In the end, he obtained $$$n$$$ possible intervals $$$[l_1,r_1], [l_2,r_2]...[l_n, r_n]$$$. However, he noticed that some intervals do not intersect, which would be terrible for his report. Therefore, instead of redoing the experiments and understanding what went wrong, he chose to take the largest number of intervals that have a non-empty intersection and pray that the correct value of the gravity constant is there.
Formally, you must choose the largest number $$$k$$$ of intervals $$$i_1, i_2, ... i_k$$$ such that for any two intervals $$$i_a$$$ and $$$i_b$$$, they have an intersection. Intersection at the endpoints is valid, as the intervals are closed.
The first line of the input contains only one integer $$$1 \leq n \leq 2 \cdot 10^5$$$. The following $$$n$$$ lines each contain two integers, $$$l_i$$$ and $$$r_i$$$, representing the intervals. It is guaranteed that $$$1 \leq l_i \leq r_i \leq 10^9$$$. It is possible for two intervals to be equal.
On the first line, print an integer $$$k$$$, representing the largest number of intervals with a common intersection. Then, print $$$k$$$ distinct integers representing the indices of the used intervals. If there are many answers with maximum $$$k$$$, any one is considered valid.
3 1 3 1 3 1 3
3 3 2 1
5 1 2 1 2 2 4 3 4 4 10
3 2 1 3
4 1 2 2 4 3 4 4 10
3 2 3 4
| Name |
|---|


