#BS0000456. Mèo và chuột (Cat and Mice)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Mèo và chuột (Cat and Mice)
Cat and Mice
Source: Kattis
Version: Phuoc Hung OJ Extended
Problem Statement
A cat starts at the origin of a plane. Mouse stays at and can be caught at any time from through seconds, inclusive.
Starting at time zero with speed , the cat runs directly to a chosen mouse, catches it without spending any extra time, and proceeds to the next one. After each catch, its current speed is multiplied by . Arriving exactly at the deadline is permitted; arriving later is not.
Choose the order of catching all mice to minimize the required starting speed, measured in distance units per second.
Input
The first line contains an integer .
Each of the next lines contains three integers .
The final line gives the real number with exactly two digits after the decimal point.
Output
Print the minimum initial speed. An absolute or relative error of at most is permitted.
Subtasks
- Subtask 1 (20 points): ; ; ; ; ; all positions are distinct and different from ; is given to two decimal places.
- Subtask 2 (30 points): ; ; ; ; ; all positions are distinct and different from ; is given to two decimal places.
- Subtask 3 (50 points): ; ; ; ; ; all positions are distinct and different from ; is given to two decimal places.
Examples
Input 1
1
3 4 2
.75
Output 1
2.4999999987500003
Explanation 1
The distance is 5 and the deadline is 2, so the exact optimum is .
Input 2
2
0 100 10
0 -100 100
.80
Output 2
9.999999999000002
Explanation 2
Catch mouse 1 first. Speed 10 reaches it at time 10, and the remaining 200 units at speed 8 take 25 seconds. The total 35 meets the second deadline. Any route to mouse 1 has length at least 100, making speed below 10 impossible.
Input 3
2
0 100 10
0 -100 15
.80
Output 3
23.33333333177778
Explanation 3
Order 1 then 2 requires and . Reversing the order requires . Thus the optimum is .