General Election
InterviewTime limit2sMemory limit512 MB
Sum each candidate's votes across regions and print the candidate number with the largest total.
- Level
Easy1 of 10
- Topics
- Array, Implementation
- Solved
- No attempts yet
Problem
The general election is over, and now it is time to count the votes. There are N (2 <= N <= 5) candidates and M (1 <= M <= 100) vote regions. Given the number of votes each candidate received in each region, determine the winner, the candidate with the most votes.
Input
The first line of input contains an integer T, the number of test cases.
Each test case starts with an integer N and an integer M, the number of candidates and the number of regions. The next M lines each contain N integers, v1, v2, ..., vN (0 <= vi <= 1000), the number of votes for candidate i.
Output
For each test case, output the number of the winning candidate on a line. You may safely assume that the winner is unique.