QOJ.ac

QOJ

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

#4890. This is a Training Team Mock Problem

الإحصائيات

Given an $n \times n$ binary matrix $c$, find the number of binary sequences $a$ and $b$ of length $n$ such that $c_{i,j} = a_i \lor b_j$ for all $1 \le i, j \le n$. Output the answer modulo $998\,244\,353$.

Input

The first line contains an integer $n$, representing the size of the matrix.

The next $n$ lines each contain a binary string of length $n$, where the $j$-th character of the $i$-th string represents $c_{i,j}$.

Output

Output a single integer representing the answer modulo $998\,244\,353$.

Constraints

Subtask 1 (5 points): $n \le 10$

Subtask 2 (15 points): $n \le 20$

Subtask 3 (40 points): $n \le 300$

Subtask 4 (5 points): Matrix $c$ is random.

Subtask 5 (35 points): No additional constraints.

$1 \le n \le 5000, 0 \le c_{i,j} \le 1$

Examples

Input 1

3
010
101
010

Output 1

2

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
EditorialOpen Official EditorialQingyu- Download

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.