#P12008. Dream Memory Sequence

    ID: 14111 Type: Default 1000ms 256MiB

Dream Memory Sequence

Dream Memory Sequence

Susan experienced a slumber of m days before she fell into a coma. On day 1 she had a base memory x, and on day i (\(1 \le i \le m\)) her memory became \(x + i - 1\). These m days of memories are concatenated in order to form a sequence of length m.

In her dream, this memory sequence was repeated \(k\) times consecutively. Afterwards, to wake Susan, Leuvia entered the dream and inserted additional memories which do not belong to Susan into the sequence. As a result, the final sequence is \(a_1, a_2, \ldots, a_n\) of length n.

Your task is: Given the sequence \(a\) and the integer \(k\), for every integer \(x\) in the range \(1 \le x \le V\), determine the maximum possible value of \(m\) such that the sequence \[ \underbrace{(x, x+1, \ldots, x+m-1,\; x, x+1, \ldots, x+m-1, \; \ldots, \; x, x+1, \ldots, x+m-1)}_{k \text{ times}} \] is a subsequence of \(a\). If no valid memory exists for a given \(x\), output 0 for that case.

Note: A sequence \(b_1, b_2, \ldots, b_t\) is a subsequence of \(a\) if there exists indices \(1 \le i_1 < i_2 < \cdots < i_t \le n\) such that \(b_j = a_{i_j}\) for all \(1 \le j \le t\).

inputFormat

The first line contains three integers \(n\), \(k\), and \(V\) (the length of the sequence, the number of repetitions, and the maximum possible value of \(x\), respectively).

The second line contains \(n\) integers \(a_1, a_2, \ldots, a_n\) representing the sequence.

outputFormat

Output \(V\) integers separated by spaces. The \(i\)th integer is the maximum value of \(m\) for \(x = i\) such that the subsequence defined above exists in \(a\); if no valid subsequence exists for this \(x\), output 0.

sample

10 2 3
1 2 3 2 3 4 3 4 5 6
0 2 2