#K62052. Highest Scoring Contestant
Highest Scoring Contestant
Highest Scoring Contestant
You are given a list of contestants participating in a coding competition. Each contestant is represented by a line containing their handle, the number of challenges they completed, and details about their side activities. For each contestant, the score is calculated as follows:
$$\text{score} = \text{challenges} + \text{sc\_sa} \times \text{pos} - \text{sc\_fa} \times \left(\frac{\text{neg}}{100}\right) \times \text{pos} + \text{dc\_sa} \times \text{pos} - \text{dc\_fa} \times \left(\frac{\text{neg}}{100}\right) \times \text{pos}$$
Here, challenges is the base score from coding challenges, sc_sa is the number of successful side activities, sc_fa is the number of failed side activities in the first category, and dc_sa and dc_fa are the corresponding numbers for the second category. The integers pos and neg denote the points awarded for each successful activity and the penalty percentage (applied to pos) for each failed activity, respectively.
Your task is to determine the contestant with the highest score. In case of ties, the contestant who appears first (according to input order) is considered the winner.
inputFormat
The first line of the input contains three numbers: an integer n representing the number of contestants, an integer pos which is the positive scoring value per successful activity, and an integer neg which is the penalty percentage applied per failed activity.
This is followed by n lines, where each line contains details for a contestant in the format:
handle challenges sc_sa sc_fa dc_sa dc_fa
All values are separated by spaces.
outputFormat
Output a single line containing the handle of the contestant with the highest score.
## sample4 100 20
Alice 3000 5 2 3 1
Bob 3500 6 1 1 0
Charlie 2800 4 3 4 2
Diana 3200 3 0 5 5
Bob