Universal Cup Judging System

Universal Cup

Límite de tiempo: 2.0 s Límite de memoria: 1024 MB Puntuación total: 100
Estadísticas

Þér er gefin runa af lengd $N$, $A = (A_1, A_2, \dots, A_N)$. Fyrir þessa runu $A$, framkvæmdu eftirfarandi aðgerð í röð fyrir $i = 1, 2, \dots, N - 1$:

  • Annaðhvort víxlaðu $A_i$ og $A_{i+1}$, eða gerðu ekkert.

Finndu fjölda ólíkra runa sem geta komið út eftir að þessar aðgerðir hafa verið framkvæmdar, modulo $998244353$.

Inntak

Inntakið er gefið á eftirfarandi sniði:

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

  • Öll inntök eru heiltölur.
  • $1 \le N \le 10^6$
  • $1 \le A_i \le N$

Úttak

Prentaðu svarið í einni línu.

Dæmi

Inntak 1

5
1 2 1 2 3

Úttak 1

10

Inntak 2

9
3 1 6 2 2 7 7 6 6

Úttak 2

104

Athugasemd

Í fyrsta dæminu eru $10$ mögulegar runur sem geta komið út eftir að aðgerðirnar hafa verið framkvæmdar. Þessar runur eru:

  • $(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.