Universal Cup Judging System

Universal Cup

Süre Sınırı: 3 s Bellek Sınırı: 2048 MB Toplam puan: 100 Zorluk: [göster] Hack'lenebilir ✓
İstatistikler

小青魚有一個 $n \times n$ 的矩陣 $W$。

對於滿足 $1 \le a_i \le n$ 的整數序列 $a_1, a_2, \ldots, a_n$,令 $b_i$ 表示在前綴 $a_1, a_2, \ldots, a_i$ 中出現次數最多的相異整數個數。例如,在前綴 $1, 2, 1, 2, 3$ 中,$1$ 和 $2$ 都出現了兩次,因此 $b_5 = 2$。

小青魚將該序列的權重定義為

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

求所有此類序列的權重之和。由於答案可能非常大,請將其對 $998\,244\,353$ 取模後輸出。

輸入格式

輸入的第一行包含一個整數 $n$($1 \le n \le 100$),表示序列的長度以及矩陣的大小。

接下來的 $n$ 行描述矩陣 $W$。其中第 $i$ 行包含 $n$ 個整數 $w_{i,1}, w_{i,2}, \ldots, w_{i,n}$($0 \le w_{i,j} < 998\,244\,353$)。

輸出格式

輸出一行一個整數,表示所有此類序列的權重之和對 $998\,244\,353$ 取模後的結果。

範例

輸入格式 1

1
7

輸出格式 1

7

輸入格式 2

2
1 2
3 4

輸出格式 2

14

輸入格式 3

3
1 1 1
3 1 1
0 0 1

輸出格式 3

6

說明

在第一個範例測試資料中,唯一的序列是 $(1)$,其權重為 $7$。

在第二個範例測試資料中,序列 $(1, 1)$ 和 $(2, 2)$ 的權重均為 $3$,而 $(1, 2)$ 和 $(2, 1)$ 的權重均為 $4$。總和為 $3 + 3 + 4 + 4 = 14$。

在第三個範例測試資料中,唯若三個值皆相異時,序列的權重才非零。共有六個這樣的序列,每個序列的權重均為 $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.