#P7072. [CSP-J 2020] 直播获奖

[CSP-J 2020] 直播获奖

Problem 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%w\%, meaning the lowest score among the contestants currently ranked in the top w%w\% is the real-time cutoff score.

More specifically, if the scores of pp contestants have been announced so far, then the planned number of awardees is max(1,p×w%)\max(1, \lfloor p \times w \%\rfloor), where ww is the award percentage, x\lfloor x \rfloor means rounding xx down, and max(x,y)\max(x,y) means the larger of xx and yy. 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,wn, w, representing the total number of contestants and the award rate.
The second line contains nn integers, in order, representing the scores as they are announced one by one.

Output Format

Only one line, containing nn 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.

10 60
200 300 400 500 600 600 0 300 200 100

200 300 400 400 400 500 400 400 300 300
10 30
100 100 600 100 100 100 100 100 100 100
100 100 600 600 600 600 100 100 100 100

Hint

Explanation of Sample 1


Constraints and Notes

For each test point, nn is as shown in the table:

Test Point ID n=n=
131 \sim 3 1010
464 \sim 6 500500
7107 \sim 10 20002000
111711 \sim 17 10410^4
182018 \sim 20 10510^5

For all test points, each contestant’s score is a non-negative integer not exceeding 600600. The award percentage ww is a positive integer and 1w991 \le w \le 99.


Hint

When computing the planned number of awardees, if you store the award ratio w%w\% using floating-point variables (such as float, double in C/C++, real, double, extended in Pascal, etc.), then the result of 5×60%5 \times 60\% might be 3.0000013.000001 or 2.9999992.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