41. I, Zombie

Time Limit: 2 seconds

Memory Limit: 128 MB

Rating: 1000

Problem Statement

Note: rows are referred to as lanes in this question Always staying on the plant side can be boring, so it is time for you to join the zombies! In the game mode of “I, Zombie”, you play as the zombie. You are given an integer $n$, representing the dimensions of the lawn. The lawn will be of $n * n$ size. There are $n$ lanes in the lawn, and each lane has n plants in it. The number on the $i$-th row and the $j$-th column represents the attack power of the plant at that position. The higher the attack power of a plant, the plant will be stronger and deadlier. The lane attack power is defined as the sum of the attack power of the plants in that lane. Since you are playing as the zombies, you want to pick the lane which has the lowest lane attack power so that you have a bigger chance of winning. Determine the lane number with the lowest attack power. Your answer should be an integer between $1$ and $n$. Note: your answer should be based on 1-indexing, which means the first lane is referred to as lane $1$, and the last lane is referred to as lane $n$.

Input

The first line contains integer $n$ $(1 \le n \le 100)$. The next $n$ lines each contain $n$ integers representing the lane.

Output

Output the lane number with the lowest attack power.

Sample Cases
Sample Input 1:
5
3 5 5 1 3
5 3 2 1 2
1 3 4 4 3
3 2 5 5 1
2 3 3 4 2

Sample Output 1:
2


Sample Input 2:
6
1 7 9 5 8 6
9 7 8 4 6 5
9 7 8 5 5 8
1 6 2 7 4 1
4 7 7 7 2 9
1 5 6 9 7 3

Sample Output 2:
4
Explanation

For the first sample case, the lane attack power of lane 1 is the sum of the first row, which is 3 + 5 + 5 + 1 + 3 = 17. Similarly, we can calculate the lane attack power for all the lanes. The attack power of lanes 1 to 5 are 17, 13, 15, 16, 14 respectively. Hence, lane 2 has the lowest lane attack power.

Sources

KL Coding Cup March 2023 > Plants vs Zombies > Problem 2

Submit | Back