Parachute
Time limit1sMemory limit512 MB
Given fall speed, parachute glide speed, a walk speed, and cars parked at integer x positions, find the minimum time to reach the safe zone at x = Xe.
- Level
Medium6 of 10
- Topics
- Math, Implementation, Greedy, Brute force
- Solved
- No attempts yet
Problem
Gyuhwan started playing a battle royale game. A hundred players compete to survive on one two dimensional map that spans from to . Coordinates are written in the order . Surviving to the end means taking a safe area early.
When the game starts, Gyuhwan falls straight down from the starting point at the constant speed . During the free fall he cannot move left or right, and he may open the parachute at any moment he likes. Once the parachute is open he can move horizontally at a speed of at most , and the falling speed drops to . The horizontal speed is anything between and , and accelerating takes no time. The x coordinate of the landing point must always be an integer that is at least 0.
After he lands, meaning his y coordinate becomes 0, he can walk or drive a car. His walking speed is , and there are cars. Each car has a position and a speed . A car accelerates in no time, switching cars takes no time, and turning a car around takes no time. No two cars sit at the same position.
There are three ways to reach the safe zone . He can open the parachute and fly straight there, he can land and walk, or he can land and drive a car.
For example, take , , and the starting point , as in the picture below. While falling, his speed along the x axis is and his speed along the y axis is . After 5 seconds he is at . If he opens the parachute there and moves right at the top speed , his speed along the x axis becomes and his speed along the y axis becomes , so 10 seconds later he arrives at . Taking car 1, which is parked there, gives him a speed of , and 1 second later he reaches the safe zone.

Find the earliest time at which Gyuhwan can reach the safe zone.
Input
The first line contains the size of the map along the x axis , the number of cars , the vertical falling speed , the maximum horizontal speed with an open parachute , and the walking speed . is a natural number at most 200, is 0 or a natural number at most 100, is a natural number with , is a natural number with , and is a natural number with .
The second line contains and of the starting point and the x coordinate of the safe zone . is a natural number with , is an integer with , and is an integer with .
Each of the next lines contains the position of one car and its speed . is an integer with , and is a natural number with .
Output
Print the minimum time to reach the safe zone on one line, rounded to eight digits after the decimal point.