#P11255. Chasing Raindrops

    ID: 13327 Type: Default 1000ms 256MiB

Chasing Raindrops

Chasing Raindrops

Moon finds himself on a 2D plane, but he can only walk along the line (y=0) at a speed no more than (v_c\ m/s). Soon heavy rain begins and there are (n) raindrops. The (i)th raindrop starts at ((x_i, y_i)) and falls vertically at a constant speed (v_g\ m/s). Meanwhile, a strong wind blows in the positive (x)‐direction at speed (v_w\ m/s), so each raindrop acquires the same horizontal speed as the wind. (Note that the wind does not affect Moon’s walking speed.)

When a raindrop falls, it lands on the (x)–axis at time (t_i=\frac{y_i}{v_g}) and its landing position is (L_i=x_i+\frac{v_w}{v_g}y_i). Both Moon and each raindrop are regarded as points. Moon gets wet by a raindrop only if he is exactly at the landing position (L_i) at time (t_i).

Starting from an initial position ((s,0)), Moon can move along the line (y=0) at a maximum speed of (v_c). In order to be hit by a raindrop at landing, if Moon catches raindrop (i) at time (t_i) and raindrop (j) at time (t_j) with (t_j>t_i), he must satisfy the condition [ |L_j-L_i|\le v_c\times(t_j-t_i), ] meaning he can move from (L_i) to (L_j) in the available time.

You are given (q) queries. In the (i)th query, Moon starts at ((s_i,0)). Determine the maximum number of raindrops that can hit Moon (i.e. the maximum number of raindrop events he can catch) if he plans his route optimally.

inputFormat

The input begins with a single line containing five space-separated integers:

• (n) — the number of raindrops • (q) — the number of queries • (v_c) — the maximum speed of Moon • (v_g) — the falling speed of the raindrops • (v_w) — the speed of the wind

Following this, there are (n) lines. Each of these lines contains two integers (x_i) and (y_i), representing the initial coordinates of a raindrop.

Then, there are (q) lines, each containing one integer (s_i) — the initial (x)-position of Moon for that query.

outputFormat

For each query, output a single integer on a new line — the maximum number of raindrops that can hit Moon when starting from that query’s initial position.

sample

3 3 2 1 1
0 2
1 3
-2 1
0
-2
5
2

2 2

</p>