#P3358. 最长k可重区间集问题
最长k可重区间集问题
Description
Given a set of open intervals on the real line and a positive integer , design an algorithm to select a set of open intervals such that at any point on , the number of intervals in that contain is at most , and is maximized ( denotes the length of the open interval ).
Such a set is called a longest -overlap interval set of . The value is called the length of a longest -overlap interval set.
Given the set of open intervals and the positive integer , compute the length of a longest -overlap interval set of .
Input Format
The first line contains two positive integers and , denoting the number of open intervals and the allowed maximum number of overlaps. Each of the next lines contains two integers, the left and right endpoints of an open interval. It is guaranteed that .
Output Format
Output the length of a longest -overlap interval set.
4 2
1 7
6 8
7 10
9 13
15
Hint
For of the testdata, , , .
Translated by ChatGPT 5
京公网安备 11011102002149号