| Contests - ACM Student Chapter - PSUT |
|---|
| Private |
| Spectator |
| PSUT Marathon 2025 |
|---|
| Finished |
This contest uses time limits scaling policy (depending on a programming language). The system automatically adjusts time limits by the following multipliers for some languages. Despite scaling (adjustment), the time limit cannot be more than 30 seconds. Read the details by the link.
You are given an $$$N \times N$$$ grid representing a section of a Mario Kart track. Each cell contains a non-negative integer.
Each racer is positioned at a fixed cell (with value 0) and cannot move to any other location. From this position, they can instantly collect all strawberry mushrooms from their immediately adjacent cells (up, down, left, and right). Each racer collects mushrooms independently, so the same mushroom block can be fully collected by multiple racers if it is adjacent to more than one of them.
Red Mushroom fan club Find a single racer who can collect the maximum total number of strawberry mushrooms from their adjacent cells. Output their 0-indexed row and column.
If multiple racers can collect the same maximum amount, output the one with the lowest coordinates. Coordinates $$$(r_1, c_1)$$$ are considered lower than $$$(r_2, c_2)$$$ if $$$r_1 \lt r_2$$$, or if $$$r_1 = r_2$$$ and $$$c_1 \lt c_2$$$.
Note: It is guaranteed that the grid has at least one racer in it.
The first line contains a single integer $$$N$$$ ($$$2 \le N \le 1000$$$) — the size of the grid.
Then $$$N$$$ lines follow, each with $$$N$$$ non-negative $$$a_{i,j}$$$ ($$$0 \le a_{i,j} \le 10^6$$$) — the number written in each cell.
Output two space-separated integers: the row and column of a racer who can collect the most mushrooms (0-indexed).
If multiple racers can collect the same maximum amount, output the one with the lowest coordinates. Coordinates $$$(r_1, c_1)$$$ are considered lower than $$$(r_2, c_2)$$$ if $$$r_1 \lt r_2$$$, or if $$$r_1 = r_2$$$ and $$$c_1 \lt c_2$$$.
30 2 01 0 30 4 0
1 1
310 0 105 5 510 0 12
2 1
| Name |
|---|

