#K39417. Find Best Discounts
Find Best Discounts
Find Best Discounts
You are given a number of users. For each user, a list of available discount offers is provided. Each discount offer is represented as a pair of integers: the discount value d and the probability p (in percent) that the discount will be used.
The expected revenue for an offer is computed as \( d \times \frac{p}{100} \). Your task is to select, for each user, the discount offer that yields the maximum expected revenue. In case there are multiple offers with the same expected revenue, you must choose the one with the smallest discount value.
Input/Output Requirements: The program should read input from standard input (stdin) and output the result to standard output (stdout).
inputFormat
The first line contains an integer \( n \) which is the number of users.
For each of the next \( n \) lines, the first integer \( m \) denotes the number of discount offers available for that user, followed by \( m \) pairs of integers. Each pair consists of a discount value \( d \) and a probability \( p \) (as a percentage).
All numbers are separated by spaces.
outputFormat
Output a single line containing \( n \) integers, where each integer is the optimal discount offer for the corresponding user. The integers should be separated by a space.
## sample3
3 10 50 20 70 30 90
2 5 30 15 80
4 7 60 40 50 50 20 60 90
30 15 60