CF1121C.System Testing

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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

There are nn solutions, the ii -th of them should be tested on aia_i tests, testing one solution on one test takes 11 second. The solutions are judged in the order from 11 to nn . There are kk testing processes which test solutions simultaneously. Each of them can test at most one solution at a time.

At any time moment tt 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 ii , then it is being tested on the first test from time moment tt till time moment t+1t + 1 , then on the second test till time moment t+2t + 2 and so on. This solution is fully tested at time moment t+ait + a_i , and after that the testing process immediately starts testing another solution.

Consider some time moment, let there be exactly mm fully tested solutions by this moment. There is a caption "System testing: dd %" on the page with solutions, where dd 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 nn and kk ( 1n10001 \le n \le 1000 , 1k1001 \le k \le 100 ) standing for the number of submissions and the number of testing processes respectively.

The second line contains nn positive integers a1,a2,,ana_1, a_2, \ldots, a_n ( 1ai1501 \le a_i \le 150 ), where aia_i is equal to the number of tests the ii -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
    

说明/提示

Consider the first example. At time moment 00 both solutions start testing. At time moment 4949 the first solution is fully tested, so at time moment 49.549.5 the second solution is being tested on the test 5050 , and the caption says "System testing: 5050 %" (because there is one fully tested solution out of two). So, the second solution is interesting.

Consider the second example. At time moment 00 the first and the second solutions start testing. At time moment 3232 the first solution is fully tested, the third solution starts testing, the caption says "System testing: 2525 %". At time moment 32+24.5=56.532 + 24.5 = 56.5 the third solutions is being tested on test 2525 , the caption is still the same, thus this solution is interesting. After that the third solution is fully tested at time moment 32+33=6532 + 33 = 65 , the fourth solution is fully tested at time moment 65+1=6665 + 1 = 66 . The captions becomes "System testing: 7575 %", and at time moment 74.574.5 the second solution is being tested on test 7575 . So, this solution is also interesting. Overall, there are two interesting solutions.

首页