Time Limit: 2 second(s) | Memory Limit: 32 MB |
In a strange shop there are n types of coins of value A_{1}, A_{2} ... A_{n}. C_{1}, C_{2}, ... C_{n} denote the number of coins of value A_{1}, A_{2} ... A_{n} respectively. You have to find the number of different values (from 1 to m), which can be produced using these coins.
Input starts with an integer T (≤ 20), denoting the number of test cases.
Each case starts with a line containing two integers n (1 ≤ n ≤ 100), m (0 ≤ m ≤ 10^{5}). The next line contains 2n integers, denoting A_{1}, A_{2} ... A_{n}, C_{1}, C_{2} ... C_{n} (1 ≤ A_{i} ≤ 10^{5}, 1 ≤ C_{i} ≤ 1000). All A_{i} will be distinct.
For each case, print the case number and the result.
Sample Input |
Output for Sample Input |
2 3 10 1 2 4 2 1 1 2 5 1 4 2 1 |
Case 1: 8 Case 2: 4 |
Developed and Maintained by
JANE ALAM JAN |
Copyright © 2012
LightOJ, Jane Alam Jan |