#C11624. Order Fulfillment Verification
Order Fulfillment Verification
Order Fulfillment Verification
You are given the inventory of a store and a list of customer orders. The inventory is represented as a list of items, each with an item identifier and the quantity available in stock. Each customer order specifies a number of items and, for each item, an identifier and the quantity requested.
Your task is to determine for each order whether the inventory can independently fulfill the order. That is, for each order, check if for every item in that order, the inventory contains at least the required quantity.
Note that each order is processed independently with the original inventory.
The conditions can be mathematically described using the following condition: For each order j and for each item (\(i\)) requested in order j with quantity \(q_{ij}\), let \(s_i\) be the stock available for the item \(i\). Then the order can be fulfilled if, for all requested items \(i\), we have:
[ s_i \geq q_{ij} ]
inputFormat
The input is read from standard input (stdin) and has the following format:
- The first line contains a single integer \(n\) which is the number of inventory items.
- The next \(n\) lines each contain two integers: the item identifier and the available quantity.
- The following line contains a single integer \(m\) which is the number of orders.
- The next \(m\) lines each describe an order. Each order consists of several space-separated integers. The first integer \(k\) represents the number of distinct items in the order, followed by \(2 \times k\) integers, where each pair is an item identifier and the quantity requested.
outputFormat
For each order, output a single line containing either "Yes" if the order can be completely fulfilled, or "No" otherwise.
## sample5
101 50
102 20
103 10
104 5
105 30
3
2 101 5 102 10
3 101 60 103 5 104 1
1 105 25
Yes
No
Yes
</p>