#C952. Order Fulfillment Checker
Order Fulfillment Checker
Order Fulfillment Checker
You are given an inventory list and a list of orders. Each inventory record consists of an item identifier and its available quantity. Each order consists of an item identifier and a requested quantity. Determine for each order whether it can be fulfilled based on the inventory.
An order can be fulfilled if and only if the available quantity of the item is at least as large as the requested quantity, i.e. $$available \geq requested$$.
For example, if the inventory is [(1, 50), (2, 30), (3, 20), (4, 10)]
and the orders are [(1, 20), (2, 40), (4, 10)]
, then the output should be:
Yes No Yes
inputFormat
The input is given via standard input (stdin) and has the following format:
- An integer
n
representing the number of items in the inventory. n
lines follow, each containing two integers: the item identifier and its available quantity.- An integer
m
representing the number of orders. m
lines follow, each containing two integers: the item identifier and the requested quantity.
Note: All numbers are separated by spaces and/or newlines.
outputFormat
For each order, output a single line with Yes
if the order can be fulfilled, or No
otherwise. The outputs must be printed to standard output (stdout), each on its own line.
4
1 50
2 30
3 20
4 10
3
1 20
2 40
4 10
Yes
No
Yes
</p>