Monk and circular distance

0

0 votes
Searching algorithm, Binary search algorithm, Algorithms
Problem

Its time for yet another challenge, and this time it has been prepared by none other than Monk himself for Super-Hardworking Programmers like you. So, this is how it goes:

Given N points located on the co-ordinate plane, where the ith point is located at co-ordinate (xi, yi), you need to answer q queries.

In the ith query, you shall be given an integer ri, and considering you draw a circle centered at the origin (0,0) with radius ri, you need to report the number of points lying inside or on the circumference of this circle.

For each query, you need to print the answer on a new line.

Input Format :

The first line contains a single integer N denoting the number of points lying on the co-ordinate plane. Each of the next N lines contains 2 space separated integers xi and yi, denoting the x and y co-ordintaes of the ith point.

The next line contains a single integer q, denoting the number of queries. Each of the next q lines contains a single integer, where the integer on the ith line denotes the parameters of the ith query ri.

Output Format :

For each query, print the answer on a new line.

Constraints :

1N105

109xi,yi109

1q105

0ri1018

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

For the 1st query in the sample, the circle with radius equal to 3 looks like this on the co-ordinate plane

enter image description here

The points : (1,1), (1,1) and (2,2) lie inside or on the circumference of the circle.

Editor Image

?