#P16599. [SYSUCPC 2025] Arc Path

    ID: 16368 Type: RemoteJudge 2000ms 256MiB Tried: 0 Accepted: 0 Difficulty: 9 Uploaded By: Tags>计算几何2025Special Judge最短路哈希 hashing随机化高校校赛极角排序

[SYSUCPC 2025] Arc Path

题目描述

There are nn circles on a plane. The ii-th circle has a center at (xi,yi)(x_i,y_i) and a radius of rir_i. These nn circles are pairwise non-intersecting, but they may be tangent (including internally or externally). There are two points SS and TT located on the arcs of these circles. Student A\texttt{Student A} starts at point S and can only travel along the circular arcs. Each circle has a parameter viv_i, which represents the time per unit length of traveling along the arc of that circle. The goal is to find the minimum total time for Student A\texttt{Student A} to travel from point SS to point TT along the circular arcs.

输入格式

The first line contains five integers: $n(1≤n≤10^4), S_x,S_y, T_x,T_y( |S_x|,|S_y|,|T_x|,|T_y|≤10^9)$. Here, nn denotes the number of circles on the plane, (Sx,Sy)(S_x,S_y) represents the coordinates of the initial position SS of \texttt{Student A}, and (Tx,Ty)(T_x,T_y) denotes the coordinates of the target destination TT.

The next nn lines each contain four positive integers $x_i,y_i,r_i,v_i( |x_i|,|y_i|≤10^9, 1≤r_i≤10^8, 0≤v_i≤10^5)$, representing the parameters of the ii-th circle: the center coordinates are (xi,yi)(x_i,y_i), the radius is rir_i, and the cost per unit length of traveling along the arc of this circle is viv_i.

The data guarantees that points SS and TT are located on the arcs of two (possibly distinct) circles, no two circles intersect (they may be tangent, either internally or externally), and no two circles are entirely coincident (i.e., there are no two circles with identical center coordinates and equal radius).

输出格式

Output a single line containing a real number, which represents the minimum total cost for Student A\texttt{Student A} to travel from point SS to point TT. If it is impossible to reach the destination, output 1-1.

The correctness of your answer is judged as follows:

If your determination of whether the destination is reachable (i.e., outputting 1-1 or a real number) differs from the standard answer, your answer is considered wrong.

If your determination matches the standard answer (both output 1-1 or both output a real number), and assuming your output is Your_AnswerYour\_Answer and the standard answer is AnswerAnswer, your answer is considered correct if it satisfies either:$\frac{|Your\_Answer - Answer|}{Answer + 1} ≤ 10^{-6}$ or Your_AnswerAnswer106|Your\_Answer-Answer| ≤ 10^{-6}.

3 0 1 3 0
1 1 1 1
3 1 1 2
4 1 4 3
6.283185307179586

3 -10 0 0 0
0 0 10 2
0 0 8 3
0 4 4 5
-1

提示

:::align{center} :::

As shown in the example figure above, Circle 1 is denoted by the lowercase letter a, Circle 2 by b, and Circle 3 by c. One possible path achieving the minimum cost to travel from point SS to point TT is marked by the red path.