#P3357. 最长k可重线段集问题
最长k可重线段集问题
Description
Given a set of open line segments in the plane , and a positive integer . Design an algorithm to select a subset such that, for any point on the -axis, the number of open line segments in that intersect the line does not exceed , and is maximized. Such a subset is called the longest -overlap set of open line segments of . The value is called the length of the longest -overlap segment set.
For any open line segment with endpoints and , its length is defined as:
Given the open line segment set and the positive integer , compute the length of the longest -overlap open segment set of .
Input Format
The first line contains positive integers and , denoting the number of open line segments and the allowed overlap count.
The next lines each contain integers, giving the coordinates of the endpoints of an open line segment.
Output Format
Output the computed length of the longest -overlap segment set.
4 2
1 2 7 3
6 5 8 3
7 8 10 5
9 6 13 9
17
Hint
Constraints: , , and all coordinates are within the int range.
Translated by ChatGPT 5
京公网安备 11011102002149号