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

ל-Little Cyan Fish יש מטריצה $W$ מגודל $n \times n$.

עבור סדרת שלמים $a_1, a_2, \ldots, a_n$ המקיימת $1 \le a_i \le n$, נסמן ב-$b_i$ את מספר השלמים השונים המופיעים מספר הפעמים הרב ביותר ברישא $a_1, a_2, \ldots, a_i$. לדוגמה, ברישא $1, 2, 1, 2, 3$, גם $1$ וגם $2$ מופיעים פעמיים, ולכן $b_5 = 2$.

Little Cyan Fish מגדיר את המשקל של הסדרה להיות

$$\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.