#P5554. 篮球统计
篮球统计
Description
When a basketball is thrown into the air, Xiao L records a time , from which this basketball starts being counted by Xiao L. When a basketball is caught, Xiao L records a time , after which the state of this basketball is no longer counted by Xiao L. For each basketball, Xiao L computes the height of this basketball at time and its initial upward velocity.
For a time , Xiao L wants to know: among all basketballs that are still in the air at that moment, what is the height of the highest one.
Note: The discovered basketballs' times and Xiao L's query times have no monotonicity.
Input Format
The first line contains an integer .
The next lines each describe an operation or a query, in one of the following forms:
-
add a v l r: Xiao L discovers a basketball in the air. This basketball is thrown into the air at time and is caught at time . Its height at time is , and its initial upward velocity is . -
query x: Please tell Xiao L, based on the information he has given so far, what the maximum height is among all basketballs that are in the air at time .
Output Format
For each query operation, output one line containing this maximum height. If there is no basketball in the air at that time, output Undefined.
To reduce precision errors, it is recommended to use the long double type to store floating-point numbers, and use %Lf as the output format.
To avoid precision issues, this problem uses Special Judge. If the difference between your answer and the reference solution's answer is less than or equal to , it will be considered correct.
5
query 1.000
add 1.000 5.000 1.000 2.000
query 1.000
query 2.000
query 1.500
Undefined
1.000000
1.100000
2.275000
Hint
For of the testdata, .
For another of the testdata, .
For of the testdata, , , , . It is guaranteed that all decimals in the input have exactly digits after the decimal point.
The basketball's height may be negative.
Xiao K Teaches You Physics
All units in this problem use the International System of Units (SI). That is, the time unit is seconds (), and the length unit is meters ().
In this problem, the gravitational acceleration is .
Ignoring the horizontal displacement of the basketball, we can treat its motion as vertical upward throw motion. Based on the information given in the statement, if the basketball's initial height is , initial velocity is , gravitational acceleration is , and the time in the air is , then the height of the basketball at that time is .
Translated by ChatGPT 5
京公网安备 11011102002149号