#P15540. [CCC 2026 J5/S2] Beams of Light
[CCC 2026 J5/S2] Beams of Light
Description
Along one wall of a parking garage there are identical parking spots numbered from to . A collection of lights illuminates the parking garage. Each light shines on some number of adjacent parking spots.
:::align{center}
:::
You will be questioned about the parking spots. For each parking spot you are questioned about, your job is to determine whether or not it is illuminated by at least one light.
Input Format
The first line of input contains a positive integer, , representing the number of parking spots. The second line contains a non-negative integer, , representing the number of lights. The third line contains a positive integer, , representing the number of parking spots you will be questioned about.
The next lines provide information about the L lights. Line i will contain two integers, and , separated by a single space. The first integer, , represents the number of the parking spot above which a light is hung. The second integer, , represents the spread of the light’s beam. Light shines on the parking spot that is directly below it. It also shines on the parking spots located on either side, unless there are fewer than spots on a side, in which case all the spots on that side will be illuminated. There could be more than one light directly above a parking spot.
The next lines of input each contain a positive integer between and inclusive, representing the number of the parking spot you are questioned about.
Output Format
There will be one line of output for each of the parking spots you are questioned about.
On each of these lines, output if the corresponding parking spot is illuminated by at least one light, or if the corresponding parking spot is not illuminated by any light.
10
3
4
8 0
1 1
4 2
4
10
7
1
Y
N
N
Y
Hint
Explanation of Output for Sample Input
The input describes the picture of the parking garage shown above.
Parking spots and are illuminated by at least one light.
Parking spots and are not illuminated by any light.
The following table shows how the available marks are distributed:
| Marks | Number of Spots | Number of Lights | Number of Questions |
|---|---|---|---|
京公网安备 11011102002149号