Problems > Richest Row

Richest Row

Difficulty: 900 2000 ms 128 MB

implementation

Print the 1-based index of the row with the largest sum (smallest index on ties).

Input: the first line has N and M; the next N lines each have M integers.

Output: the index of the richest row.

Constraints:

  • 1 ≤ N, M ≤ 100
  • −104 ≤ values ≤ 104

Sample Tests

Input 1
2 3
1 2 3
3 2 2
Output 1
2
Input 2
1 1
-5
Output 2
1

Read the Editorial

Discussion (opens after you solve — no spoilers before)

No comments yet.

Submit Your Solution

Log in or create a free account to run and submit code.