#C8830. Restock Items
Restock Items
Restock Items
You are given the inventory data of a store. The store has N different types of items. For each item, you are provided:
id
: A unique identifier for the item.current_stock
: The current number of units in stock.threshold
: The minimum required units for that item.
In addition, you are given a list of restocking quantities, one for each item.
Your task is to determine which items need to be restocked. An item needs restocking if its current stock is less than the threshold. In other words, if
\[
\text{current\_stock} < \text{threshold}
\]
for an item, you should output its id
along with the corresponding restocking quantity. The output should be sorted in increasing order of id
.
If none of the items need restocking, print All items are sufficiently stocked
.
Note: Input is to be read from standard input and output is to be printed to standard output.
inputFormat
The first line contains an integer N
, the number of items.
The next N
lines each contain three integers separated by spaces: id
, current_stock
and threshold
.
The final line contains N
integers separated by spaces, representing the restocking quantities for each item respectively.
outputFormat
If at least one item needs to be restocked (i.e. when current_stock < threshold
), output each such item on a new line in the format:
id: restock_quantity
Items should be printed in ascending order of their id
.
If no item needs restocking, output a single line:
All items are sufficiently stocked## sample
3
101 3 5
102 2 2
103 0 1
5 10 15
101: 5
103: 15
</p>