P23161 [AtCoder] Rail Tour
NOI
题目描述

Problem Description

There is a city represented as an infinite $xy$ plane.

Currently, amylase is at point ($x_s$, $y_s$) and wants to move to point ($x_g$, $y_g$).

There is only one railway in this city, called the Land Railway, which is represented as a polyline passing through $n$ points ($x_1$, $y_1$), ($x_2$, $y_2$) ... ($x_n$, $y_n$) in order. This railway does not intersect itself.

amylase can get on and off the railway at any point, and can move in either direction on the railway at speed $v$. Elsewhere, they can move at speed $1$.

Find the minimum time required for amylase to move.

Input Format

The input is given in the following format:

$n$ $v$ $x_s$ $y_s$ $x_g$ $y_g$ $x_1$ $y_1$ ... $x_n$ $y_n$

  • The first line contains an integer $n$ ($2 \leq n \leq 50$), representing the number of points constituting the railway; an integer $v$ ($2 \leq v \leq 1,000,000$), representing the speed on the railway; and integers $x_s$, $y_s$ ($-1,000,000 \leq x_s, y_s \leq 1,000,000$), representing the coordinates of the starting point; and integers $x_g$, $y_g$ ($-1,000,000 \leq x_g, y_g \leq 1,000,000$), representing the coordinates of the destination point.
  • The following $n$ lines contain the coordinates of each point constituting the railway.
  • $x_i$, $y_i$ ($-1,000,000 \leq x_i, y_i \leq 1,000,000$) represent the coordinates of the $i$-th point of the railway as ($x_i$, $y_i$).
  • All given coordinates are integers.

Output Format

Output the minimum time required to move from the starting point to the destination point in one line.

The answer will be considered correct if the absolute or relative error is at most $10^{-6}$.

End with a newline and do not include any extra characters or blank lines.

Sample Input and Output

Sample Input #1

2 2 -10 0 20 0
0 0
10 0

Sample Output #1

25

Sample Input #2

2 2 0 3 20 3
0 0
20 0

Sample Output #2

15.1961524227

Sample Input #3

2 2 0 3 10 3
0 0
10 0

Sample Output #3

10

Sample Input #4

4 3 -10 10 10 -20
0 10
0 0
-10 -10
10 -10

Sample Output #4

33.5702260396

Sample Input #5

4 3 -10 10 10 -20
0 10
0 0
-50 -10
10 -10

Sample Output #5

34.9509379141

Notes/Hints

None

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
2 2 -10 0 20 0 0 0 10 0
样例输出
25