302923: CF570A. Elections
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Elections
题意翻译
**【题目描述】** 有 $n$ 个候选人,$m$ 个城市,每一个城市给出每一个候选人的票数,票数最多的就被这个城市选了。当票数一样是,号码最小的被这个城市选。获得票数最多的候选人候选人当选,当有多个候选人获得的票数一样时,号码最小的候选人当选。 **【输入格式】** 第一行有两个整数 $n,m$($1 \le n,m \le 100$),表示候选人的个数和城市的个数。 以下 $m$ 行每行都有 $n$ 个非负整数,第 $i$ 行第 $j$ 个的整数 $a_{i, j}$($1 \le j \le n$,$1 \le i \le m$,$0 \le a_{i, j} \le {10}^9$)表示第 $i$ 个城市给出的第 $j$ 个候选人的选票数。 **【输出格式】** 一个整数,表示当选的人的编号。题目描述
The country of Byalechinsk is running elections involving $ n $ candidates. The country consists of $ m $ cities. We know how many people in each city voted for each candidate. The electoral system in the country is pretty unusual. At the first stage of elections the votes are counted for each city: it is assumed that in each city won the candidate who got the highest number of votes in this city, and if several candidates got the maximum number of votes, then the winner is the one with a smaller index. At the second stage of elections the winner is determined by the same principle over the cities: the winner of the elections is the candidate who won in the maximum number of cities, and among those who got the maximum number of cities the winner is the one with a smaller index. Determine who will win the elections.输入输出格式
输入格式
The first line of the input contains two integers $ n $ , $ m $ ( $ 1<=n,m<=100 $ ) — the number of candidates and of cities, respectively. Each of the next $ m $ lines contains $ n $ non-negative integers, the $ j $ -th number in the $ i $ -th line $ a_{ij} $ ( $ 1<=j<=n $ , $ 1<=i<=m $ , $ 0<=a_{ij}<=10^{9} $ ) denotes the number of votes for candidate $ j $ in city $ i $ . It is guaranteed that the total number of people in all the cities does not exceed $ 10^{9} $ .
输出格式
Print a single number — the index of the candidate who won the elections. The candidates are indexed starting from one.
输入输出样例
输入样例 #1
3 3
1 2 3
2 3 1
1 2 1
输出样例 #1
2
输入样例 #2
3 4
10 10 3
5 1 6
2 2 2
1 5 7
输出样例 #2
1