PivotOJ

Valley Gulls

시간 제한: 2000ms메모리 제한: 2048MB출처: ICPC ECNA 2025-2026BOJ 35384

문제

The Cliff Valley complex is so called because of the steep, vertical cliffs that enclose its series of valleys and hills. Besides this unique geographical layout, one of the things it is most known for are the Blue-Throated Mountain Gulls which make their nests on the scenic hills in the complex. The other thing it is known for is rain --- lots of rain. This can make it tough on the Blue-Throated Mountain Gulls as often their nests have to be abandoned due to rising flood waters. Famous for their unique beauty and haunting bird song, the species is not the brightest when it comes to choosing nesting habitats.

Environmentalist Audrey Bond has been put in charge of modeling the flooding in the valley and the threat this poses to the gulls. She has decided to go with simple 22-D slices of the valley to make things simpler. She has somewhat limited information on the layout of the valley and only has a small set of elevation points from a previous survey with which to work, the first and last of which are located at the cliff walls (see Figure 1a). She also knows that no nests are at these points, as the Blue-Throated Mountain Gull can get pretty unruly when a surveyor gets close to their nest. Given these points, Audrey intends to fit a piece-wise, first-degree interpolation curve to model each valley slice. In other words, she's going to draw straight lines between each pair of consecutive points. An example is shown in Figure 1b.

Figure 1: (a) Survey points (Sample Input 1). (b) Straight line connection of points

For a given rate of rainfall, Audrey figures it will be easy to determine how long it will take flood waters to reach any given Blue-Throated Mountain Gull nest in the valley. Or at least she thought it would be easy --- turns out even modeling with straight lines is a little harder than she thought. Can you help a gull out?

입력

The first line of input contains three values pp rr mm where p(2p50)p (2 \leq p \leq 50) is a positive integer indicating the number of survey points, r(0.0<r3.0)r (0.0 < r \leq 3.0) is the rate of rainfall in feet per hour, and m(1m100)m (1 \leq m \leq 100) is a positive integer indicating the number of nests. The value of rr will have at most two digits after the decimal point. Following this is a single line with pp pairs of integer values xix_i yiy_i (0xi5000,1000yi1000)(0 \leq x_i \leq 5000, -1000 \leq y_i \leq 1000) specifying the pp survey points, in feet. No two survey points will have the same xx or yy value. The xx values are in ascending order and no three consecutive points will be collinear. The first and last xx values correspond to the locations of the cliff and you may assume that the heights of the cliff sides are greater than all the yy values of the survey points. The final line of input contains mm integers n1n_1 n2nmn_2 \ldots n_m (x1<n1<n2<<nm<xp)(x_1 < n_1 < n_2 < \cdots < n_m < x_p) indicating the xx values of mm nest locations. None of the corresponding yy values for these xx values equal any yy value of a survey point.

출력

Output mm lines, one for each of the corresponding mm nest locations, specifying the time in hours that flood waters would reach the nest, assuming the rain starts at time t=0t=0 and continues at a steady rate of rr. Answers will be judged correct if they have an absolute or relative error no worse than 10510^{-5}.

예제

예제 1

입력
4 0.2 2
0 5 10 10 30 -20 40 20
6 18
출력
4.50000000
21.68750000
코드를 제출하려면 로그인하세요.