#P11109. [ROI 2023] 会议 (Day 2)
[ROI 2023] 会议 (Day 2)
Background
Translated from ROI 2023 D2T2。
The Peruvian Association of Science and Education is organizing a conference and plans to hold activities, numbered from to . Let and be the start and end times of activity , respectively. Since some activities may overlap, a person may not be able to attend all of them. Activities and are considered non-conflicting if or .
A set of activities is called compatible if every two different activities in the set are non-conflicting. Suppose the maximum size of a compatible set is . The saturation of the conference is defined as . Due to budget cuts, the organizers decided to reduce the number of conference activities by half. At the same time, they want the saturation to remain unchanged, so in the reduced set of activities, the maximum size of a compatible set must also be reduced by half.
It is guaranteed that, in the original conference plan, both the number of activities and the maximum compatible set size are even.
Problem Description
Help the organizers choose activities from the plan so that the maximum size of a compatible set among the chosen activities is .
Input Format
Each test contains multiple test cases.
The first line contains an integer , the number of test cases ().
The first line of each test case contains an integer , the number of activities in the original plan (, and is even).
In the next lines, the activities are described. Each line contains two integers and , the start and end times of activity ().
It is guaranteed that the maximum compatible set size in the original plan is even, and .
Output Format
For each test case, output distinct activity indices in one line, representing the activities that will be kept. If there are multiple valid answers, output any of them. The maximum size of a compatible set among the selected activities must be .
2
8
12 14
1 3
2 4
1 10
5 6
7 9
8 10
11 13
6
1 2
2 4
1 2
1 4
5 7
6 8
2 5 3 4
1 2 3
Hint
Sample explanation:

The figure above shows the initial set of activities in the first test case. One possible maximum compatible set is marked with a thick dashed line.

The figure above shows the set of activities in one valid answer for the first test case. One possible maximum compatible set is marked with a thick dashed line.

The initial set of activities in the second test case.

The set of activities in one valid answer for the second test case.
Let . We say that activity completely covers activity if and only if .
| Subtask | Score | Special Properties | |
|---|---|---|---|
| Any two activities are non-conflicting. | |||
| For any two activities and , they are either non-conflicting, or one completely covers the other; and there is an activity that completely covers all other activities. | |||
| For any two activities and , they are either non-conflicting, or one completely covers the other. | |||
Translated by ChatGPT 5