#FW0000109. Thoát khỏi cảnh sát (Speedy Escape)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Thoát khỏi cảnh sát (Speedy Escape)
Speedy Escape
Source: Kattis
Version: Phuoc Hung OJ Extended
Problem Statement
Two brothers start at intersection while a police car starts at . All roads are bidirectional with lengths measured in units of 100 meters. The police car can travel at up to km/h and change speed/direction at will. Both parties depart simultaneously. Find the minimum maximum speed that allows the brothers to follow a fixed route to a highway exit without any possible collision, including collisions inside roads. If impossible, print IMPOSSIBLE.
Input
First line , then roads , then exit vertex IDs, then .
Output
Print IMPOSSIBLE or the minimum speed in km/h, accepted within absolute or relative error.
Subtasks
-
Subtask 1 (40 points): . All input-format and graph conditions above apply.
-
Subtask 2 (60 points): . All input-format and graph conditions above apply.
Examples
Input
3 2 1
1 2 7
2 3 8
1
2 3
Output
74.666666666667
Explanation
Police starts at 3, the brothers at 2, the exit at 1. Police can reach the exit over distance 15 at 160 km/h, while the brothers travel distance 7. Thus the limiting speed is km/h.