Under construction

Still being built. Things may change

Street Lamps

Interview

Time limit2sMemory limit1024 MB

Summary
Given lamp positions on a line, list the K smallest distances from integer positions 0 to L to the nearest lamp, in increasing order.
Level

Medium5 of 10

Topics
Heap, Sorting, Math
Solved
No attempts yet

Problem

A number line road has NN street lamps that are on. Listing their positions from left to right gives A1<⋯<ANA_1 < \cdots < A_N.

The darkness of a position xx is defined as the distance from xx to the nearest lamp. This equals the smallest value among ∣A1−x∣,⋯ ,∣AN−x∣|A_1 - x|, \cdots, |A_N - x|, where ∣⋅∣|\cdot| is the absolute value, so ∣y∣:=y|y| := y if y≥0y \ge 0 and ∣y∣:=−y|y| := -y if y<0y < 0.

For example, suppose N=3N = 3 and the lamps are at A1=1A_1 = 1, A2=4A_2 = 4, and A3=8A_3 = 8. The darkness of each integer position from 0 to 10 is shown below.

Position012345678910
Darkness10110121012
Lamp here?○○○

Compute the darkness of all L+1L+1 integer positions from x=0x = 0 to x=Lx = L. Output the KK smallest values in increasing order.

Input

The first line contains three integers LL, NN, and KK, separated by spaces.

The second line contains NN integers A1,⋯ ,ANA_1, \cdots, A_N, separated by spaces.

Output

Print KK lines. The ii-th line contains the ii-th smallest darkness value.

Constraints

  • 1≤L≤10181 \le L \le 10^{18}
  • 1≤N≤300,0001 \le N \le 300{,}000
  • 1≤K≤500,0001 \le K \le 500{,}000
  • K≤L+1K \le L + 1
  • 0≤A1<A2<⋯<AN≤L0 \le A_1 < A_2 < \cdots < A_N \le L
  • All given numbers are integers.

Examples4

  1. Example 1

    Input
    10 3 4
    1 4 8
    
    Expected output
    0
    0
    0
    1
    
  2. Example 2

    Input
    4 5 5
    0 1 2 3 4
    
    Expected output
    0
    0
    0
    0
    0
    
  3. Example 3

    Input
    7 1 4
    3
    
    Expected output
    0
    1
    1
    2
    
  4. Example 4

    Input
    9 4 10
    0 3 6 9
    
    Expected output
    0
    0
    0
    0
    1
    1
    1
    1
    1
    1