#P15784. [JAG 2025 Summer Camp #3] Fireworks
[JAG 2025 Summer Camp #3] Fireworks
题目描述
There are apartment buildings equally spaced along a straight line. Building () is located at coordinate and has height .
This year, a fireworks festival will be held, and the residents of each building want to watch the fireworks from its rooftop. However, depending on the launch position, their view may be blocked by other buildings. To avoid this, for each given launch coordinate , determine the minimum height such that all residents can see the fireworks.
More formally, find the minimum non-negative real number such that there do not exist indices () for which the line segment connecting and (excluding endpoints) intersects with the line segment connecting and (excluding endpoints).
输入格式
The input consists of a single test case in the following format.
$$\begin{aligned} & N \ L \ Q \\ & H_{1} \ H_{2} \ \ldots \ H_{N} \\ & X_{1} \\ & \vdots \\ & X_{Q} \end{aligned}$$The first line contains integers (), (), and (), representing the number of apartment buildings, the distance between adjacent buildings, and the number of candidate launch coordinates, respectively.
The next line contains integers (), representing the height of building .
Each of the following lines contains an integer (, for ), representing a candidate coordinate for launching the fireworks.
输出格式
For the queries, output the answers separated by newlines. On the -th line, output the minimum launch height required when the fireworks are launched at coordinate . The answer will be considered correct if the absolute or relative error is less than .
3 7 3
5 9 13
10
-9
28
6.7142857143
0
17