#C7066. Wi-Fi Coverage Determination

    ID: 50896 Type: Default 1000ms 256MiB

Wi-Fi Coverage Determination

Wi-Fi Coverage Determination

You are given a set of Wi-Fi zones and a list of homes along a one-dimensional line. Each Wi-Fi zone is defined by a coordinate X and a range R. A home is covered by Wi-Fi if it lies within the range of at least one zone, i.e. if \(|home - X| \le R\) for some zone. Your task is to determine for each home whether it is covered by Wi-Fi.

Input/Output: You will read the input from stdin and write the result to stdout. The input format and output format are described below.

inputFormat

The first line of the input contains an integer \(M\) representing the number of Wi-Fi zones. The next \(M\) lines each contain two integers: the coordinate \(X\) and the range \(R\) of a Wi-Fi zone. The following line contains an integer \(H\) representing the number of homes. The next \(H\) lines each contain a single integer denoting the coordinate of a home.

For example:

2
1 2
4 1
3
2
-1
7

outputFormat

Output \(H\) lines, each containing either "Yes" if the corresponding home has Wi-Fi coverage or "No" if it does not.

For the input example above, the output should be:

Yes
Yes
No
## sample
2
1 2
4 1
3
2
-1
7
Yes

Yes No

</p>