Universal Cup Judging System

Universal Cup

시간 제한: 2.0 s 메모리 제한: 1024 MB 총점: 100
통계

נתונה לך סדרה באורך $N$, $A = (A_1, A_2, \dots, A_N)$. עבור סדרה זו $A$, בצע את הפעולה הבאה לפי הסדר עבור $i = 1, 2, \dots, N - 1$:

  • החלף בין $A_i$ ל-$A_{i+1}$, או אל תעשה דבר.

מצא את מספר הסדרות השונות שיכולות להתקבל לאחר ביצוע פעולות אלו, מודולו $998244353$.

קלט

הקלט ניתן בפורמט הבא:

$$\begin{aligned} &N \\ &A_1 \ A_2 \ \dots \ A_N \end{aligned}$$

  • כל ערכי הקלט הם מספרים שלמים.
  • $1 \le N \le 10^6$
  • $1 \le A_i \le N$

פלט

הדפס את התשובה בשורה בודדת.

דוגמאות

קלט 1

5
1 2 1 2 3

פלט 1

10

קלט 2

9
3 1 6 2 2 7 7 6 6

פלט 2

104

הערה

בדוגמה הראשונה, ישנן $10$ סדרות אפשריות שיכולות להתקבל לאחר ביצוע הפעולות. סדרות אלו הן:

  • $(1, 2, 1, 2, 3)$,
  • $(1, 2, 1, 3, 2)$,
  • $(1, 2, 2, 1, 3)$,
  • $(1, 2, 2, 3, 1)$,
  • $(1, 1, 2, 2, 3)$,
  • $(1, 1, 2, 3, 2)$,
  • $(2, 1, 1, 2, 3)$,
  • $(2, 1, 1, 3, 2)$,
  • $(2, 1, 2, 1, 3)$,
  • $(2, 1, 2, 3, 1)$.

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#1409EditorialOpen题解jianglyView

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.