P14562 Universe

Description

Yuki is a dimensional girl from another world! She lives on a spaceship in an $n$-dimensional universe, with coordinates $(v_1,\dots,v_n)$. Suddenly, her detector shows that a black hole at the origin of the universe is expanding: for all positive integers $i$, at the $i$-th second, if the coordinate of the spaceship in any dimension is less than or equal to $i$, then Yuki and her spaceship will be eaten by the black hole! To escape, Yuki needs to try her best to stay away from the black hole: for all positive integers $i$, at the $(i-0.5)$-th second, if Yuki has not been eaten by the black hole yet, then she needs to choose $k$ **different** dimensions $s_1,\dots,s_k$ and increase $v_{s_1},\dots,v_{s_k}$ all by $1$. However, because the dashboard of the spaceship is broken, Yuki does not know how much fuel the spaceship has left. Therefore, she wants you to find, for every positive integer $k$ less than $n$, the maximum non-negative integer $x$ such that, under the optimal strategy, Yuki has not been eaten by the black hole at the $x$-th second. It is easy to prove that such a non-negative integer $x$ exists.

Input Format

The first line contains two integers $c,n$, where $c$ denotes the test case number. $c=0$ means that this test case is a sample. The second line contains $n$ integers $v_1,\dots,v_n$.

Output Format

Output one line containing $n-1$ integers, where the $i$-th integer denotes the answer when $k=i$.

Explanation/Hint

### Sample 1 Explanation For the case $k=1$, Yuki can change the coordinates from $(1,2,3)$ to $(2,2,3)$ at the $0.5$-th second. It is easy to prove that Yuki will definitely be eaten by the black hole at the $2$-nd second, so the answer is $1$. For the case $k=2$, Yuki can change the coordinates to $(2,3,3),(3,3,4),(4,4,4)$ at the $0.5$-th, $1.5$-th and $2.5$-th seconds respectively. It is easy to prove that Yuki will definitely be eaten by the black hole at the $4$-th second, so the answer is $3$. ### Sample 2 See $\textbf{\textit{universe/universe2.in}}$ and $\textbf{\textit{universe2.ans}}$ in the attached files. This sample satisfies the constraints of test case $3$. ### Sample 3 See $\textbf{\textit{universe/universe3.in}}$ and $\textbf{\textit{universe3.ans}}$ in the attached files. This sample satisfies the constraints of test case $6$. ### Sample 4 See $\textbf{\textit{universe/universe4.in}}$ and $\textbf{\textit{universe4.ans}}$ in the attached files. This sample satisfies the constraints of test case $9$. ### Sample 5 See $\textbf{\textit{universe/universe5.in}}$ and $\textbf{\textit{universe5.ans}}$ in the attached files. This sample satisfies the constraints of test case $15$. ### Sample 6 See $\textbf{\textit{universe/universe6.in}}$ and $\textbf{\textit{universe6.ans}}$ in the attached files. This sample satisfies the constraints of test case $20$. ### Constraints For all testdata, the following is guaranteed: - $2 \le n \le 10^6$; - $1 \le v_i \le 10^9$. ::cute-table{tuack} | Test Case | $n \le$ | $v_i \le$ | Special Property | | :--------: | :-----: | :-------: | :------: | | $1\sim2$ | $80$ | $80$ | Yes | | $3\sim5$ | $80$ | $80$ | No | | $6\sim8$ | $10^3$ | $10^9$ | Yes | | $9\sim12$ | $10^3$ | $10^9$ | No | | $13\sim14$ | $10^6$ | $10^6$ | Yes | | $15\sim16$ | $10^6$ | $10^6$ | No | | $17\sim18$ | $10^6$ | $10^9$ | Yes | | $19\sim20$ | $10^6$ | $10^9$ | No | Special property: it is guaranteed that all $v_i$ are equal. Translated by QwenWork