#P7459. [CERC2018] Reservoir Dog
[CERC2018] Reservoir Dog
Description
Translated from [CERC2018] Reservoir Dog.
You take your dog to a reservoir next to your home to play. Your dog likes playing frisbee, but since you are tired of playing frisbee with your dog, you are curious about the total time from when you throw the frisbee to when your dog picks it up and returns to you. So you bring the dog to your side and start the timer. At time milliseconds, you throw the frisbee horizontally from height millimeters with initial speed millimeters per millisecond. Due to gravity, the frisbee’s vertical acceleration is millimeter per millisecond squared.
At time milliseconds, you release the dog. The dog’s maximum horizontal speed is . The dog runs on an ideal plane, and it is smart enough to know how to minimize the time to catch the frisbee and bring it back to you. To achieve this, the dog can jump up to height millimeters, and a vertical jump does not affect its horizontal speed. After the dog catches the frisbee, it immediately runs back to you at full speed. When the dog reaches your position, you stop the timer. Note that you stop the timer even if your dog is in the air; that is, you also stop the timer if the dog is directly above the initial position.
Your dog is special because it can obtain horizontal speed instantly (with no acceleration or deceleration), and it can change the magnitude of its horizontal speed or reverse its horizontal direction even while in the air. Due to gravity, the dog’s vertical acceleration is millimeters per millisecond squared.
For simplicity, assume the sizes of the frisbee and the dog are negligible. You may use the displacement formula , though how to use it is up to you.
Input Format
The input contains one line with six integers .
Output Format
Output the time you measured (in milliseconds). Your answer is accepted if its absolute error does not exceed .
1 2 160 20 6 40
31.92569589
1 2 160 10 6 40
21.65591118
Hint
.
Clarifications
Q: How does the dog jump?
A: The dog instantly obtains a vertical speed that allows it to reach height .
Q: Does the frisbee keep moving after it hits the ground?
A: When the frisbee hits the ground, it stops moving instantly.
Translated by ChatGPT 5
京公网安备 11011102002149号