#C13987. Product Filtering
Product Filtering
Product Filtering
Given a list of products, each represented by a name, price, and stock quantity, your task is to filter out the products that do not meet the minimum requirements and then output the names of the remaining products in lexicographical order.
A product with attributes is considered valid if and only if
$$\text{price} \geq \text{min\_price} \quad \text{and} \quad \text{quantity} \geq \text{min\_stock}. $$If no products match the criteria, output an empty line.
Example: If the input is:
5 Laptop 1200 5 Smartphone 800 10 Monitor 300 7 Keyboard 100 15 Mouse 50 25 100 10
The valid products are "Keyboard" (price 100, quantity 15) and "Smartphone" (price 800, quantity 10), and when sorted lexicographically, the output is:
Keyboard Smartphone
inputFormat
Input is read from standard input (stdin) and has the following format:
- An integer $n$, representing the number of products.
- $n$ lines follow, each containing a product name (a string without spaces), an integer for the price, and an integer for the stock quantity, separated by spaces.
- A line containing two integers: $\text{min\_price}$ and $\text{min\_stock}$.
outputFormat
Output the names of the filtered products that satisfy the condition (price min_price and quantity min_stock) in lexicographical order, on a single line separated by a space. If no product meets the criteria, output an empty line.## sample
5
Laptop 1200 5
Smartphone 800 10
Monitor 300 7
Keyboard 100 15
Mouse 50 25
100 10
Keyboard Smartphone
</p>