#P3626. Meeting Center Rental Scheduling
Meeting Center Rental Scheduling
Meeting Center Rental Scheduling
The Siruseri government has built a new conference center. Many companies are interested in renting the hall to hold meetings. A company will rent the hall only if it can have the hall exclusively during its meeting. The sales manager wishes to rent the hall to as many companies as possible. However, if there are several ways to achieve the maximum number of non-overlapping meetings, the final strategy is chosen as follows: first, consider only strategies with the maximum number of companies; then, assign each company an index in the order they sent their request (starting from 1); next, sort the indices of the companies in each strategy in ascending order; finally, select the strategy whose sorted sequence of company indices is lexicographically smallest.
For example, suppose there are 4 companies with the following meeting requests:
- Company 1: Start = 4, End = 9
- Company 2: Start = 9, End = 11
- Company 3: Start = 13, End = 19
- Company 4: Start = 10, End = 17
inputFormat
The first line contains an integer (), the number of companies. Each of the next lines contains two integers and () which denote the start and end days (inclusive) of the meeting request. Two meetings conflict if they share a common day.
outputFormat
Output a single line containing the indices (as given in the input order, starting from 1) of the companies that will rent the hall. The indices must be output in ascending order, separated by single spaces.
sample
4
4 9
9 11
13 19
10 17
1 3