Skip to main content
Back to problems
Codeforces
Easy
Arrays
Simulation
Math
Contest

Given each participant's initial score and the time they spend solving problems, find who has the highest score at the end.

Acceptance 0%
Also Available On
Other platform versions and source mappings for the same problem.
Problem Statement

Contest

There are nn 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 nn — the number of participants.
  • The next nn lines contain the participant data.

Output Format

  • Print the 1-based index of the participant with the maximum final score.

Constraints

  • 1n1001 \le n \le 100
  • 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

  • nn
  • nn lines describing the participants' values

Output Format

  • A single integer: the 1-based index of the participant with the best final score

Constraints

  • 1n1001 \le n \le 100
  • Integer values fit in 32-bit signed range
Examples
Sample cases returned by the problem API.

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.

Guided hints
Editorial and discussion links
Concept map and variants
Sign in to unlock
Track your progress
Sign in to bookmark this problem, save notes, and manage its revision plan.