Universal Cup Judging System

Universal Cup

Time Limit: 3 s Memory Limit: 2048 MB Total points: 100 Difficulty: [show] Hackable ✓
Statistics

Little Cyan Fish có một ma trận $W$ kích thước $n \times n$.

Đối với một dãy số nguyên $a_1, a_2, \ldots, a_n$ thỏa mãn $1 \le a_i \le n$, gọi $b_i$ là số lượng các số nguyên phân biệt có số lần xuất hiện nhiều nhất trong tiền tố $a_1, a_2, \ldots, a_i$. Ví dụ, trong tiền tố $1, 2, 1, 2, 3$, cả $1$ và $2$ đều xuất hiện hai lần, vì vậy $b_5 = 2$.

Little Cyan Fish định nghĩa trọng số của dãy số là

$$\prod_{i=1}^n w_{i,b_i}.$$

Hãy tìm tổng trọng số của tất cả các dãy số như vậy. Vì kết quả có thể rất lớn, hãy in ra kết quả theo modulo $998\,244\,353$.

Dữ liệu vào

Dòng đầu tiên của dữ liệu vào chứa một số nguyên duy nhất $n$ ($1 \le n \le 100$), biểu thị độ dài của các dãy số và kích thước của ma trận.

$n$ dòng tiếp theo mô tả ma trận $W$. Dòng thứ $i$ trong các dòng này chứa $n$ số nguyên $w_{i,1}, w_{i,2}, \ldots, w_{i,n}$ ($0 \le w_{i,j} < 998\,244\,353$).

Dữ liệu ra

In ra một dòng duy nhất chứa một số nguyên duy nhất, biểu thị tổng trọng số của tất cả các dãy số như vậy theo modulo $998\,244\,353$.

Ví dụ

Dữ liệu vào 1

1
7

Dữ liệu ra 1

7

Dữ liệu vào 2

2
1 2
3 4

Dữ liệu ra 2

14

Dữ liệu vào 3

3
1 1 1
3 1 1
0 0 1

Dữ liệu ra 3

6

Ghi chú

Trong ví dụ thứ nhất, dãy số duy nhất là $(1)$, và trọng số của nó là $7$.

Trong ví dụ thứ hai, các dãy số $(1, 1)$ và $(2, 2)$ mỗi dãy có trọng số là $3$, trong khi $(1, 2)$ và $(2, 1)$ mỗi dãy có trọng số là $4$. Tổng là $3 + 3 + 4 + 4 = 14$.

Trong ví dụ thứ ba, một dãy số có trọng số khác không chỉ khi cả ba giá trị đều khác nhau. Có sáu dãy số như vậy, mỗi dãy có trọng số là $1$.

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#2961EditorialOpenNew Editorial for Problem #22882AnonymousView

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.