Street Lamps
InterviewTime limit2sMemory limit1024 MB
Given lamp positions on a line, list the K smallest distances from integer positions 0 to L to the nearest lamp, in increasing order.
Problem
A number line road has street lamps that are on. Listing their positions from left to right gives .
The darkness of a position is defined as the distance from to the nearest lamp. This equals the smallest value among , where is the absolute value, so if and if .
For example, suppose and the lamps are at , , and . The darkness of each integer position from 0 to 10 is shown below.
Compute the darkness of all integer positions from to . Output the smallest values in increasing order.
Input
The first line contains three integers , , and , separated by spaces.
The second line contains integers , separated by spaces.
Output
Print lines. The -th line contains the -th smallest darkness value.
Constraints
- All given numbers are integers.