CF570A 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$ 个候选人的选票数。
输出格式
一个整数,表示当选的人的编号。
说明/提示
Note to the first sample test. At the first stage city 1 chosen candidate 3, city 2 chosen candidate 2, city 3 chosen candidate 2. The winner is candidate 2, he gained 2 votes.
Note to the second sample test. At the first stage in city 1 candidates 1 and 2 got the same maximum number of votes, but candidate 1 has a smaller index, so the city chose candidate 1. City 2 chosen candidate 3. City 3 chosen candidate 1, due to the fact that everyone has the same number of votes, and 1 has the smallest index. City 4 chosen the candidate 3. On the second stage the same number of cities chose candidates 1 and 3. The winner is candidate 1, the one with the smaller index.