#K48702. Taco Baking Challenge
Taco Baking Challenge
Taco Baking Challenge
You are given a list of available ingredient quantities and several recipes, each of which requires a certain amount of each ingredient. Your task is to determine for each test case, how many recipes can be baked using the available quantities. A recipe can be baked if for every ingredient, the available quantity is at least as much as needed by the recipe.
Formally, if you are given an integer \(N\) representing the number of ingredients, an array \(Q = [q_1, q_2, \dots, q_N]\) representing the available quantity for each ingredient, and \(M\) recipes where the \(j^{th}\) recipe is represented by an array \(R_j = [r_{j1}, r_{j2}, \dots, r_{jN}]\), then you can bake the recipe \(j\) if and only if \(q_i \ge r_{ji}\) for all \(1 \le i \le N\).
Your program should process multiple test cases and output the number of recipes that can be baked for each test case.
inputFormat
The first line of input contains an integer \(T\) denoting the number of test cases. For each test case, the input is given as follows:
- An integer \(N\) representing the number of ingredients.
- A line with \(N\) space-separated integers representing the available quantities \(Q\) of each ingredient.
- An integer \(M\) representing the number of recipes.
- Then \(M\) lines follow, each containing \(N\) space-separated integers representing a recipe's ingredient requirements.
outputFormat
For each test case, output a single line containing one integer — the number of recipes that can be baked with the available ingredients.
## sample2
3
10 5 8
2
5 2 3
6 3 5
4
7 3 10 2
3
1 1 6 1
2 2 4 0
3 1 7 1
2
3
</p>