#P10410. 「QFOI R2」寺秋山霭苍苍

    ID: 11713 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 3 上传者: 标签>数学洛谷原创Special JudgeO2优化洛谷月赛

「QFOI R2」寺秋山霭苍苍

Background

Formulas that may be used in this problem:

Distance between two points: the distance between (x1,y1)(x_1,y_1) and (x2,y2)(x_2,y_2) is (x1x2)2+(y1y2)2\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}.

Heron's formula: if the side lengths of a triangle are a,b,ca,b,c, let the semiperimeter be p=a+b+c2p=\frac{a+b+c}{2}, then the area of the triangle is S=p(pa)(pb)(pc)S=\sqrt{p(p-a)(p-b)(p-c)}.

Problem Description

Little R is a cute girl, but she is very bad at geometry, so she asks you to help with this geometry problem.

In the Cartesian plane, there is a ABC\triangle\textrm{ABC} with vertices $\textrm{A}(x_1,y_1),\textrm{B}(x_2,y_2),\textrm{C}(x_3,y_3)$.

For a real number p(0,1)p\in(0,1), choose points D,E,F\textrm{D},\textrm{E},\textrm{F} on sides BC,CA,AB\textrm{BC},\textrm{CA},\textrm{AB} respectively, such that $\frac{|\textrm{AF}|}{|\textrm{AB}|}=\frac{|\textrm{BD}|}{|\textrm{BC}|}=\frac{|\textrm{CE}|}{|\textrm{CA}|}=p$. Then DEF\triangle\textrm{DEF} is called the "pp-ratio triangle" of ABC\triangle\textrm{ABC}.

Please choose a real number pp in the range [l,r][l,r] to minimize the area of the "pp-ratio triangle" of ABC\triangle\textrm{ABC}. You need to output this minimum area.

Input Format

One line with eight real numbers l,r,x1,y1,x2,y2,x3,y3l,r,x_1,y_1,x_2,y_2,x_3,y_3.

Output Format

One line with one real number SminS_{\min}, representing the minimum area.

Your output is considered correct if and only if its absolute or relative error compared to the standard answer does not exceed 10410^{-4}.

0.40 0.60 0.00 0.00 4.00 0.00 1.00 5.00
2.500000000000
0.20 0.40 0.00 0.00 4.00 0.00 1.00 5.00
2.800000000000

Hint

Explanation for Sample 11

It can be proven that the area is minimized when p=0.5p=0.5, and the minimum area is 2.52.5.


Explanation for Sample 22

It can be proven that the area is minimized when p=0.4p=0.4, and the minimum area is 2.82.8.


Scoring

This problem is judged using a Special Judge.

Your output is considered correct if and only if its absolute or relative error compared to the standard answer does not exceed 10410^{-4}.


Constraints

This problem uses bundled testdata. Only by passing all test points in a subtask and all dependent subtasks can you get the corresponding score.

For all testdata: 0<l<r<10 < l < r < 1, 0x1,y1,x2,y2,x3,y31050\le x_1,y_1,x_2,y_2,x_3,y_3\le 10^5. The input is guaranteed to form a triangle. For every real number in the input, the number of digits after the decimal point does not exceed 22.

  • Subtask 1 (2020 points): l=0.10,r=0.90l=0.10,r=0.90.
  • Subtask 2 (2020 points): x1=y1=y2=x3=0.00x_1=y_1=y_2=x_3=0.00.
  • Subtask 3 (2020 points): x1=y1=y2=0.00x_1=y_1=y_2=0.00. Depends on Subtask 2.
  • Subtask 4 (4040 points): no special constraints. Depends on Subtasks 1, 2, and 3.

Hint

Formulas that may be used in this problem:

Distance between two points: the distance between (x1,y1)(x_1,y_1) and (x2,y2)(x_2,y_2) is (x1x2)2+(y1y2)2\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}.

Heron's formula: if the side lengths of a triangle are a,b,ca,b,c, let the semiperimeter be p=a+b+c2p=\frac{a+b+c}{2}, then the area of the triangle is S=p(pa)(pb)(pc)S=\sqrt{p(p-a)(p-b)(p-c)}.

Translated by ChatGPT 5