Jogging
Time limit1sMemory limit16 MB
For each rest point given in increasing order, print the largest angle in radians to a star with greater x, or zero when no such star exists.
- Level
Medium7 of 10
- Topics
- Geometry, Sorting, Two pointers
- Solved
- No attempts yet
Problem
Daeyoung lives in a two dimensional world, so he is a single point on the axis. He jogs every evening and runs only in the direction of increasing . In this world the sky fills with stars as soon as evening comes. When the running tires him out, Daeyoung stops for a while and looks up at the stars.
A star is also a point in the plane. Daeyoung looks only at the stars whose coordinate is greater than his own, and he wants to know which of them is the highest. Highest means the star that makes him raise his head the most, that is, the star with the largest angle.
If Daeyoung rests at the point and a star is at the point , the angle to that star is the angle between the positive direction of the axis and the ray toward the star. For every rest, find the largest angle among the stars visible at that moment.

Input
The first line contains the number of stars and the number of rests , separated by a space. (, )
Each of the next lines contains two integers , separated by a space, the coordinates of one star. (, )
Each of the next lines contains the coordinate where Daeyoung rests, one per line. These coordinates are given in increasing order and their absolute value is at most .
Several stars can share the same coordinate.
Output
For each rest, print the largest angle among the visible stars in radians, rounded to seven digits after the decimal point, one per line. Print 0.0000000 when no star is visible.
The judge compares the printed text exactly. In every test the answer is far enough from a rounding boundary that double precision arithmetic produces the same text.