logo AlgoBeat OnlineJudge
登录 注册

#215841. [JAG 2025 Summer Camp #3] Fireworks

内存限制:1024 MiB 时间限制:2000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

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.

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 .

样例

样例输入 1

3 7 3
5 9 13
10
-9
28

样例输出 1

6.7142857143
0
17