题库练习 System Testing
← 上一题 下一题 →

A12413 | System Testing

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

Vasya likes taking part in Codeforces contests. When a round is over, Vasya follows all submissions in the system testing tab.

There are $n$ solutions, the $i$ -th of them should be tested on $a_i$ tests, testing one solution on one test takes $1$ second. The solutions are judged in the order from $1$ to $n$ . There are $k$ testing processes which test solutions simultaneously. Each of them can test at most one solution at a time.

At any time moment $t$ when some testing process is not judging any solution, it takes the first solution from the queue and tests it on each test in increasing order of the test ids. Let this solution have id $i$ , then it is being tested on the first test from time moment $t$ till time moment $t + 1$ , then on the second test till time moment $t + 2$ and so on. This solution is fully tested at time moment $t + a_i$ , and after that the testing process immediately starts testing another solution.

Consider some time moment, let there be exactly $m$ fully tested solutions by this moment. There is a caption "System testing: $d$ %" on the page with solutions, where $d$ is calculated as

$$$$d = round\left(100\cdot\frac{m}{n}\right), $$ </p><p>where $round(x) = \\lfloor{x + 0.5}\\rfloor$ is a function which maps every real to the nearest integer.</p><p>Vasya calls a submission <span class="tex-font-style-it">interesting</span> if there is a time moment (possibly, non-integer) when the solution is being tested on some test $q$ , and the caption says "System testing: $q$$$%". Find the number of interesting solutions.

Please note that in case when multiple processes attempt to take the first submission from the queue at the same moment (for instance, at the initial moment), the order they take the solutions does not matter.

输入格式

The first line contains two positive integers $n$ and $k$ ( $1 \le n \le 1000$ , $1 \le k \le 100$ ) standing for the number of submissions and the number of testing processes respectively.

The second line contains $n$ positive integers $a_1, a_2, \ldots, a_n$ ( $1 \le a_i \le 150$ ), where $a_i$ is equal to the number of tests the $i$ -th submission is to be run on.

输出格式

Output the only integer — the number of interesting submissions.

输入输出样例

输入 #1
2 2
49 100
输出 #1
1
输入 #2
4 2
32 100 33 1
输出 #2
2
输入 #3
14 5
48 19 6 9 50 20 3 42 38 43 36 21 44 6
输出 #3
5
C++ 编辑器
输入
输出