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

Gegeben ist eine Folge der Länge $N$, $A = (A_1, A_2, \dots, A_N)$. Führe für diese Folge $A$ der Reihe nach für $i = 1, 2, \dots, N - 1$ die folgende Operation aus:

  • Vertausche entweder $A_i$ und $A_{i+1}$, oder tue nichts.

Bestimme die Anzahl der verschiedenen Folgen, die nach dem Ausführen dieser Operationen entstehen können, modulo $998244353$.

Eingabe

Die Eingabe erfolgt im folgenden Format:

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

  • Alle Eingaben sind ganze Zahlen.
  • $1 \le N \le 10^6$
  • $1 \le A_i \le N$

Ausgabe

Gib die Antwort in einer einzigen Zeile aus.

Beispiele

Eingabe 1

5
1 2 1 2 3

Ausgabe 1

10

Eingabe 2

9
3 1 6 2 2 7 7 6 6

Ausgabe 2

104

Hinweis

Im ersten Beispiel gibt es $10$ mögliche Folgen, die nach dem Ausführen der Operationen entstehen können. Diese Folgen sind:

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