eolymp
bolt
Спробуйте наш новий інтерфейс для відправки розв'язків
Задачі

Runaway Domino

Runaway Domino

"Domino effect" is a famous play using dominoes. A player sets up a chain of dominoes stood. After a chain is formed, the player topples one end of the dominoes. The first domino topples the second domino, the second topples the third and so on. You are playing domino effect. Before you finish to set up a chain of domino, a domino block started to topple, unfortunately. You have to stop the toppling as soon as possible. The domino chain forms a polygonal line on a two-dimensional coordinate system without self intersections. The toppling starts from a certain point on the domino chain and continues toward the both end of the chain. If the toppling starts on an end of the chain, the toppling continue toward the other end. The toppling of a direction stops when you touch the toppling point or the toppling reaches an end of the domino chain. You can assume that: \begin{itemize} \item You are a point without volume on the two-dimensional coordinate system. \item The toppling stops soon after touching the toppling point. \item You can step over the domino chain without toppling it. \end{itemize} You will given the form of the domino chain, the starting point of the toppling, your coordinates when the toppling started, the toppling velocity and the your velocity. You are task is to write a program that calculates your optimal move to stop the toppling at the earliest timing and calculates the minimum time to stop the toppling. \InputFile _ _ _ _ _ _ The first line contains one integer \textbf{N} (\textbf{2} ≤ \textbf{N} ≤ \textbf{1000}), which denotes the number of vertices in the polygonal line of the domino chain. Then \textbf{N} lines follow, each consists of two integers \textbf{x_i} and \textbf{y_i}, which denote the coordinates of the \textbf{i}-th vertex (\textbf{-10000} ≤ \textbf{x_i}, \textbf{y_i} ≤ \textbf{10000}). The next line consists of three integers \textbf{x_t}, \textbf{y_t} and \textbf{v_t}, which denote the coordinates of the starting point and the velocity of the toppling. The last line consists of three integers \textbf{x_p}, \textbf{y_p} and \textbf{v_p}, which denotes the coordinates of you when the toppling started and the velocity (\textbf{1} ≤ \textbf{v_t} < \textbf{v_p} ≤ \textbf{10}). You may assume that the starting point of the toppling lies on the polygonal line. \OutputFile Print the minimum time to stop the toppling. The output must have a relative or absolute error less than \textbf{10^\{-6\}}.
Ліміт часу 3 секунди
Ліміт використання пам'яті 64 MiB
Вхідні дані #1
2
0 0
15 0
5 0 1
10 10 2
Вихідні дані #1
5.00000000000000000000
Джерело Japan Alumni Group Winter Contest 2012