QOJ.ac

QOJ

حد الوقت: 1.0 s حد الذاكرة: 256 MB مجموع النقاط: 100 قابلة للهجوم ✓

#12398. 矩阵方程

الإحصائيات

我们称一个 $N \times N$ 的矩阵为“01 方阵”,如果它的所有元素均为 0 或 1。

对于两个 01 方阵 $X, Y$,我们定义两种运算 $X \times Y$ 和 $X \odot Y$。它们的运算结果也都是 01 方阵,计算方式如下(我们用 $Z$ 表示 $X \times Y$,用 $D$ 表示 $X \odot Y$):

$$Z_{i,j} = \left(\sum_{k=1}^{N} X_{i,k}Y_{k,j}\right) \bmod 2$$ $$D_{i,j} = X_{i,j}Y_{i,j}$$

现在 MianKing 有两个 01 方阵 $A, B$,他想要解如下矩阵方程:

$$A \times C = B \odot C$$

你需要帮助 MianKing 解决这个问题,计算有多少个 01 方阵 $C$ 满足该方程。 答案可能非常大,因此你只需要输出答案对 $998244353$ 取模的结果。

输入格式

第一行包含一个整数 $N$。 接下来 $N$ 行,每行包含 $N$ 个整数,第 $i$ 行的第 $j$ 个整数表示 $A_{i,j}$。 接下来 $N$ 行,每行包含 $N$ 个整数,第 $i$ 行的第 $j$ 个整数表示 $B_{i,j}$。

$1 \le N \le 200, A_{i,j}, B_{i,j} \in \{0, 1\}$

输出格式

输出答案对 $998244353$ 取模的结果。

样例

样例输入 1

2
0 1
1 1
1 0
0 1

样例输出 1

2

样例输入 2

3
1 0 0
0 1 0
0 0 1
1 1 1
1 1 1
1 1 1

样例输出 2

512

样例输入 3

4
0 1 0 1
0 1 1 0
0 1 1 1
1 0 0 1
1 0 1 1
0 1 1 1
1 0 0 1
1 1 1 0

样例输出 3

8

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.