luogu#P8592. 『JROI-8』颅脑损伤 2.0(加强版)
『JROI-8』颅脑损伤 2.0(加强版)
Background
Note the special time limit of this problem.
Problem Description
Given line segments, where the -th segment is , color each segment either red or black, such that:
- 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 there exists and .
Input Format
The first line contains a positive integer .
The next lines each contain two integers , separated by a space.
Output Format
Output one non-negative integer: 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, .
This problem uses bundled tests.
Translated by ChatGPT 5