| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 58 | 45 | 32 | 74.419% |
$N$ 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 $M$ 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 $N$ (1ドル \le N \le 100$), the number of monkeys, and $M$ (1ドル \le M \le 100$), the number of jumps. Each of the following $N$ lines contains $M$ space-separated integers $A_i$ ($-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 0ドル$ 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,ドル \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.
2 2 1 0 0 3
1
Two monkeys, each jumped twice. The first jump of the first monkey was 1ドル$cm up. For the monkey to return to the initial position, the second jump must have been 1ドル$cm down. The average height measured relative to the starting point was $(1 + 0) / 2 = 0.5$.
The first jump of the second monkey must have been 3ドル$ cm down for it to return to the initial position with the second jump. The average height was $(-3 + 0) / 2 = -1.5$.
So, the average height of the monkey number 1ドル$ was 0ドル.5$ and the average height of the monkey number 2ドル$ was $-1.5$. Thus, on the average, the monkey number 1ドル$ was on the highest level.
3 4 -2 4 0 6 -3 0 -8 9 4 5 -7 0
3
The "unknown" jumps of the monkeys are $-8,ドル 2ドル,ドル and $-2$cm, respectively.
Their heights after each jump:
$-2,ドル 2ドル,ドル $-6,ドル 0ドル$;
$-3,ドル $-1,ドル $-9,ドル 0ドル$;
4ドル,ドル 9ドル,ドル 2ドル,ドル 0ドル$.
Their average heights:
$(-2 + 2 + (-6) + 0) / 4 = -1.5$;
$(-3 + (-1) + (-9) + 0) / 4 = -3.25$;
$(4 + 9 + 2 + 0) / 4 = 3.75$.
Olympiad > Estonian Informatics Olympiad > 2020-21 > Final Round 2번