#P4605. [SDOI2018] 物理实验
[SDOI2018] 物理实验
Description
Xiao T has a physics lab class this semester. To successfully finish the experiment in the next class, he plans to preview it before class.
This experiment is conducted on a 2D plane. On the plane there is an infinitely long straight guide rail. On the rail, there is a laser emitter of length . The laser emitter emits laser beams of width to both sides of the rail along the direction perpendicular to the rail.
There are also baffles on the plane. Each baffle can be regarded as a line segment. Now each baffle does not touch the straight guide rail, and the angle between it and the rail is at most . Any two baffles also do not touch each other. The laser beams cannot pass through these baffles, and will be absorbed by them, not reflected.
Xiao T wants to determine a position of the laser emitter such that the total length of baffles illuminated by the laser beams is maximized. You need to help Xiao T compute this maximum value.
Input Format
The first line contains a positive integer , indicating the number of testdata groups.
For each testdata group, the first line contains an integer , indicating the number of baffles.
The next lines each contain four integers , indicating that the two endpoints of the baffle are and , guaranteeing .
The -th line contains five integers , indicating that the straight guide rail passes through points and , and the length of the laser emitter is , also guaranteeing .
Output Format
For each testdata group, output one line containing a real number, representing the maximum total length of baffles that can be illuminated by the laser beams. The relative error must not exceed , that is, let your output be and the standard answer be . If , then your output will be considered correct.
3
4
-3 2 -1 2
-1 -1 1 -1
0 1 2 1
2 -2 4 -2
0 0 1 0 2
4
1 1 3 3
2 1 4 2
3 1 5 1
3 -1 4 -1
0 0 -1 0 2
4
-2 0 1 2
1 3 -3 2
1 -3 5 -1
2 -1 4 3
0 0 1 1 2
3.000000000000000
3.118033988749895
4.251303782246768
Hint
Constraints
- .
- .
- .
- The absolute value of all coordinates does not exceed .
SubTasks
- Subtask 1 (40 points): and the absolute value of all coordinates does not exceed .
- Subtask 2 (40 points): the absolute value of all coordinates does not exceed .
- Subtask 3 (20 points): no additional constraints.
Translated by ChatGPT 5
京公网安备 11011102002149号