QOJ.ac

QOJ

时间限制: 1.0 s 内存限制: 512 MB 总分: 100 可 Hack ✓

#7042. 太简单了

统计

G 先生发明了一个新游戏,规则如下:

首先,他有一个 $n \times n$ 的矩阵,初始时所有元素均为 0。接着,他进行若干次操作:每次选择一行或一列,并将该行或该列中的所有元素加上一个任意的正整数。当所有操作完成后,他隐藏了矩阵中的一个元素,并将该元素修改为 $-1$。

现在给定最终的矩阵,请你求出在最后一次隐藏操作之前,被隐藏的那个元素原本的值是多少。

输入格式

第一行包含一个整数 $n$ ($2 \le n \le 1000$)。

接下来 $n$ 行表示操作后的矩阵。矩阵中的每个元素满足 $-1 \le a_{i,j} \le 1000000$,且恰好有一个元素为 $-1$。

输出格式

输出一个整数,即被隐藏的元素原本的值。

样例

样例输入 1

3
1 2 1
0 -1 0
0 1 0

样例输出 1

1

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.