Given each participant's initial score and the time they spend solving problems, find who has the highest score at the end.
Contest
There are participants in a contest. For each participant, you are given:
- their initial score,
- the time they spend solving problems,
- and the score they earn.
A participant's final score is computed from these values in the order described by the problem. Your task is to determine which participant has the best result after all calculations are applied, and output their index.
If multiple participants achieve the same best result, the earlier participant should be preferred.
Input Format
- The first line contains an integer — the number of participants.
- The next lines contain the participant data.
Output Format
- Print the 1-based index of the participant with the maximum final score.
Constraints
- The values for each participant fit in standard 32-bit signed integers.
Hints
- Compute the final result for each participant independently.
- Keep track of the current best value and its index while iterating once through the list.
Input Format
- lines describing the participants' values
Output Format
- A single integer: the 1-based index of the participant with the best final score
Constraints
- Integer values fit in 32-bit signed range
Example 1
Input
3 10 5 20 12 4 18 9 7 25
Output
2
Explanation
After evaluating the participants, the second participant has the highest final score, so the answer is 2.
Premium problem context
Unlock deeper context for this problem
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.