#P9740. ION Competition Au Score Problem
ION Competition Au Score Problem
ION Competition Au Score Problem
In the ION competition there are a total of problems, each with a maximum of 100 points. The -th problem has test cases, and since all test cases are of equal value, each test case is worth (\frac{100}{a_i}) points (thus is a divisor of 100). You have already passed test cases for the -th problem. Using some technical means, you have discovered that this year's Au score cutoff is points.\n\nNow, assume that if you devote the remaining contest time solely to problem (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 is the number of additional test cases you pass on problem . For each problem (with ), determine the minimum integer required. If it is impossible to reach even if you pass all remaining test cases on problem (i.e. if ), 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 , then you should output 0 for every problem.
inputFormat
The input consists of three lines:\n\nThe first line contains two integers and , where is the number of problems and is the Au score threshold.\nThe second line contains integers: , where each is a divisor of 100.\nThe third line contains integers: , where .
outputFormat
Output values separated by spaces. For each problem (in order from 1 to ), output the minimum number of additional test cases to pass on that problem needed to reach or exceed a total score of . If it is impossible for problem , output NaN
(without quotes).
sample
2 150
50 100
50 100
0 0