*LOJ#6227. "Network Stream 24 Questions" The longest k repeatable line segment problem

$n \leq 500$ line segments on the plane, ask for a selection method, so that there is no straight line $x=p$ and the selected straight line has more than $k$ intersections, and the total length of the selected straight line is the longest.

Each point on the abscissa opens a point, and a line segment connects the corresponding abscissa with a capacity-cost (-length) edge; point $x$ connects to point $x+1$ with an edge with capacity $k$ and cost 0. The $k$ edge here restricts the other places on the line that do not pass here.

A trick here is a line segment that is perpendicular to the $x$ axis. Direct judgment will be wa. To do this, double the coordinates, if $l=r$ then $r++$ else $l++$, which is equivalent to splitting a point into two.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324829219&siteId=291194637