#P8591. 『JROI-8』颅脑损伤 2.0
『JROI-8』颅脑损伤 2.0
Problem Description
Given line segments, where the -th segment is . Color each segment either red or black, with the following requirements:
- Any two red segments do not intersect.
- Any black segment intersects with at least one red segment.
Minimize the total length of the red segments, and output this total length.
The length of a segment is defined as . Two segments and intersect if and only if and .
Input Format
The first line contains one positive integer .
The next lines each contain two integers , separated by a space.
Output Format
Output one non-negative integer, representing the minimum possible total length of the red segments.
5
-6 5
1 3
-4 9
-1 10
6 8
4
Hint
Constraints
| Test Point ID | |
|---|---|
For all testdata, .
Translated by ChatGPT 5