QOJ.ac

QOJ

Time Limit: 1.0 s Memory Limit: 512 MB Total points: 100 Hackable ✓

#10782. 行列式

Statistics

Alice 利用矩阵 $A^T A$ 的优良性质来求矩阵 $A^T A$ 的行列式。回想一下,矩阵 $A$ 的行列式(记作 $\det(A)$)满足 $\det(A^T A) = \det(A)^2$。Alice 利用这一性质求出了 $|\det(A)|$。但不幸的是,当 $|\det(A)| \neq 0$ 时,该方法无法判断 $\det(A)$ 是正数还是负数。

现在已知矩阵 $A$ 以及 $|\det(A)|$ 的值,请判断 $\det(A)$ 是正数还是负数。

输入格式

第一行包含一个整数 $T$ ($1 \le T \le 100$),表示测试用例的数量。

对于每个测试用例,第一行包含一个整数 $n$ ($1 \le n \le 100$),表示矩阵 $A$ 的大小为 $n \times n$。

第二行包含一个大整数 $|\det(A)|$。在本题条件下,可以证明 $|\det(A)|$ 的二进制位数不超过 $10^4$ 位。

接下来的第 3 行到第 $n+2$ 行,每行包含 $n$ 个数字,描述该矩阵。保证每个数字的绝对值不超过 $10^9$。

输出格式

对于每个测试用例,输出一行,包含字符 “+” 或 “-”,表示行列式是正数还是负数。

样例

输入格式 1

3
1
1
1
2
2
1 2
3 4
2
5
-1 2
3 -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.