Monkeying Around | 프로그래밍의 벗 PivotOJ
PivotOJ

Monkeying Around

시간 제한: 1000ms메모리 제한: 1024MB출처: EIO 2020-21 finalBOJ 29901

문제

NN baby monkeys are playing in treetops. They all start from the same height, and each of them finishes where it started from. Each monkey makes MM jumps, denoted by integers that show how many centimeters higher or lower the monkey moved with that jump. For each monkey, the height of one of the jumps in unknown and represented as zero in the input data. Find the monkey who was on the highest level on average (assuming the jumps take place after equal time intervals).

입력

The first line contains NN (1N1001 \le N \le 100), the number of monkeys, and MM (1M1001 \le M \le 100), the number of jumps. Each of the following NN lines contains MM space-separated integers AiA_i (200Ai200-200 \le A_i \le 200) showing how many centimeters higher the corresponding monkey moved with the corresponding jump (negative values indicate moving lower). There is exactly one 00 on each line, indicating that we do not know how much higher or lower the monkey moved with that jump.

출력

Output exactly one integer, the index of the monkey who was on the highest level on average. The monkeys are indexed 1,,N1, \ldots, N in the order in which their data are given in the input. When computing the average, the common final height after the last jump is included, but the initial height before the first jump is excluded. If there are several monkeys with the maximal average level, output the index of any of them.

예제

예제 1

입력
2 2
1 0
0 3
출력
1

예제 2

입력
3 4
-2 4 0 6
-3 0 -8 9
4 5 -7 0
출력
3
코드를 제출하려면 로그인하세요.