P7072 [CSP-J 2020] Live Awarding

Description

NOI2130 is about to be held. To make it more enjoyable to watch, CCF decides to announce each contestant’s score one by one, and livestream the real-time award cutoff score. The award rate of this contest is $w\%$, meaning the lowest score among the contestants currently ranked in the top $w\%$ is the real-time cutoff score. More specifically, if the scores of $p$ contestants have been announced so far, then the planned number of awardees is $\max(1, \lfloor p \times w \%\rfloor)$, where $w$ is the award percentage, $\lfloor x \rfloor$ means rounding $x$ down, and $\max(x,y)$ means the larger of $x$ and $y$. If some contestants have the same score, then all contestants tied at that score can receive an award, so the actual number of awardees may be larger than planned. As a technician in the judging team, please help CCF write a livestream program.

Input Format

The first line contains two integers $n, w$, representing the total number of contestants and the award rate. The second line contains $n$ integers, in order, representing the scores as they are announced one by one.

Output Format

Only one line, containing $n$ non-negative integers, in order, representing the real-time award cutoff score after each contestant’s score is announced. Adjacent integers are separated by one space.

Explanation/Hint

### Explanation of Sample 1 ![](https://cdn.luogu.com.cn/upload/image_hosting/l453vhow.png) --- ### Constraints and Notes For each test point, $n$ is as shown in the table: | Test Point ID | $n=$ | | :--: | :--: | | $1 \sim 3$ | $10$ | | $4 \sim 6$ | $500$ | | $7 \sim 10$ | $2000$ | | $11 \sim 17$ | $10^4$ | | $18 \sim 20$ | $10^5$ | For all test points, each contestant’s score is a non-negative integer not exceeding $600$. The award percentage $w$ is a positive integer and $1 \le w \le 99$. --- ### Hint When computing the planned number of awardees, if you store the award ratio $w\%$ using floating-point variables (such as `float`, `double` in C/C++, `real`, `double`, `extended` in Pascal, etc.), then the result of $5 \times 60\%$ might be $3.000001$ or $2.999999$, and the floor result is uncertain. Therefore, it is recommended to use only integer variables to compute an exact value. Translated by ChatGPT 5