#P9740. ION Competition Au Score Problem

    ID: 22886 Type: Default 1000ms 256MiB

ION Competition Au Score Problem

ION Competition Au Score Problem

In the ION competition there are a total of nn problems, each with a maximum of 100 points. The ii-th problem has aia_i test cases, and since all test cases are of equal value, each test case is worth (\frac{100}{a_i}) points (thus aia_i is a divisor of 100). You have already passed bib_i test cases for the ii-th problem. Using some technical means, you have discovered that this year's Au score cutoff is tt points.\n\nNow, assume that if you devote the remaining contest time solely to problem jj (and do not work on any other problems), you aim to achieve Au by passing some additional test cases. That is, your final total score, which is given by\n[ \sum_{i=1}^{n} b_i \cdot \frac{100}{a_i} + d \cdot \frac{100}{a_j} \ge t ] where dd is the number of additional test cases you pass on problem jj. For each problem jj (with 1jn1 \le j \le n), determine the minimum integer dd required. If it is impossible to reach tt even if you pass all remaining test cases on problem jj (i.e. if d>ajbjd > a_j - b_j), output NaN for that problem.\n\nNote: If your current total score (S_0 = \sum_{i=1}^{n} b_i \cdot \frac{100}{a_i}) is already at least tt, then you should output 0 for every problem.

inputFormat

The input consists of three lines:\n\nThe first line contains two integers nn and tt, where nn is the number of problems and tt is the Au score threshold.\nThe second line contains nn integers: a1,a2,,ana_1, a_2, \ldots, a_n, where each aia_i is a divisor of 100.\nThe third line contains nn integers: b1,b2,,bnb_1, b_2, \ldots, b_n, where 0biai0 \le b_i \le a_i.

outputFormat

Output nn values separated by spaces. For each problem jj (in order from 1 to nn), output the minimum number of additional test cases to pass on that problem needed to reach or exceed a total score of tt. If it is impossible for problem jj, output NaN (without quotes).

sample

2 150
50 100
50 100
0 0