In the GGOI TFT 2025, they stated
Non-trainees WILL NOT have a seat reserved and should queue up in front of the reporting venue.
If there are remaining seats at the end of the reporting time, they will be admitted on a first-come-first-serve basis.
In this year's TFT, there may not be enough spaces for all non-trainees. Therefore, GGOI made this new policy, "Non-trainees are only allowed a limited time in the competition room. They are allocated $\frac{t_i}{10}$ minutes, rounded down to the nearest integer, where $t_i$ is the number of tasks they solved in GG Online Judge.
There is now a queue of $n$ people waiting to go in. There are $k$ seats for non-trainees in the room. Assuming the TFT goes on for a long long time (forever), can you determine for how many minutes in total does everyone needs to spend in the queue?
Input
The first line contains two integers $n, k$.
The second line $n$ integers, the array $t_i$, the number of tasks they solved in GGOJ.
Output
Output an integer, the total waiting minutes in the queue.
Constraints
For all testcases, $1 \le k \le n \le 10^6, 1 \le t_i \le 2000$.
Subtask 1 (99%): $n \le 1000$
Subtask 2 (1%): No additional constraints
Note: Subtask 2 is out-syllabus. Please attempt other questions first before doing this subtask!
Sample Test Cases
Input | Output | |
---|---|---|
5 2 49 58 124 71 55 |
21 | |
Person 1 and 2 gets to go in first. Person 1 leaves at the 4th minute, allowing person 3 to go in. |
Scoring: Per Subtask
Authored by s17f18
Appeared in 2025 Mini Comp 1