Magic Drone
题号:NC226659
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
Special Judge, 64bit IO Format: %lld

题目描述

    For this problem, you’re finally going to get a chance to use the drone you won a few years ago at the ICPC contest. The FAA is still cracking down on limiting the functionality of unmanned aircraft systems (UAS) so the waypoints (▽) impose legal regulations on the maximum altitude at which it is permitted to fly. 

    
    To be specific, you will fly your drone over a straight-line sidewalk which extends from –∞ to +∞. At position xi feet, the regulation forbids flying at any altitude above yi feet. As a result, you may be led to think that at each xi you can fly up and take a picture of the city from altitude yi. In reality, physical constraints may prevent you from doing so. 

    You may start your drone at rest from any point on the ground (y=0). While it is in the air, it will always move at a horizontal speed of exactly V mph. Its vertical acceleration is controllable within the range [amin, amax] mph/s, with zero response time, regardless of current altitude. It must eventually land smoothly, meaning that the vertical velocity must be zero at both takeoff and landing. 

    For each specified point xi, compute the maximum reachable altitude y’i that can be achieved in a flight that meets all of the physical and legal constraints. Note that it is not necessary to reach all of the maxima in one continuous flight. Of course, it must be the case that y’i <= yi. Note that the regulations are point constraints. 

    The drone must be at or below yi at xi but may have non-zero vertical velocity at xi

输入描述:

The input consists of multiple lines. The first line contains four space separated values: the number of points, N (1 <= N<= 2000), the horizontal speed V, (0 < V <= 10), in mph, and the vertical acceleration range, amin and amax, (-5 <= amin < 0 < amax <= 5) in mph/s.

输出描述:

The next N lines each specify a point, (xi, yi), (xi < xi+1 and 0 <= yi <= 400). (FAA Rule 14 CFR Part 107 says that a UAS may not go higher than 400 feet.) 
示例1

输入

复制
3 2 -2 2
20 30
70 400
80 250

输出

复制
30.000
284.316
250.000
示例2

输入

复制
3 2 -2 2
60 350
70 400
90 250

输出

复制
350.000
350.758
250.000
示例3

输入

复制
3 2 -1 1
38 200
60 400
70 300

输出

复制
200.000
287.500
300.000
示例4

输入

复制
3 1 -1 1
21 300
35 400
40 150

输出

复制
300.000
213.336
150.000

备注:

浮点误差精度为 3 位(1e-3),fabs(stdvalue - yourvalue) / max(1.0, fabs(stdvalue)) < 1e-3均正确