#C5727. Maximum Flowers Collection
Maximum Flowers Collection
Maximum Flowers Collection
You are given a square garden with n rows and n columns. Each cell in the garden contains a certain number of flowers. Your task is to determine the maximum number of flowers that can be collected by choosing either a single row or a single column. Mathematically, if the garden is represented by a matrix \( A \) with dimensions \( n \times n \), you need to compute:
\[ \max\left( \max_{1 \leq i \leq n} \sum_{j=1}^{n} A_{i,j}, \; \max_{1 \leq j \leq n} \sum_{i=1}^{n} A_{i,j} \right) \]
Print the computed maximum value.
inputFormat
The input is read from standard input (stdin) and consists of the following:
- The first line contains a single integer \( n \) indicating the size of the garden (i.e., the number of rows and columns).
- The next \( n \) lines each contain \( n \) space-separated integers representing the number of flowers in each cell of the row.
outputFormat
Output a single integer which is the maximum number of flowers that can be collected from either one row or one column of the garden. The output should be written to standard output (stdout).
## sample3
1 2 3
4 5 6
7 8 9
24