Universal Cup Judging System

Universal Cup

시간 제한: 4.0 s 메모리 제한: 1024 MB 총점: 100 해킹 가능 ✓
통계

Beschreibung

Gegeben sind eine positive ganze Zahl $N$, eine Primzahl $P$ und eine Folge positiver ganzer Zahlen $A = (A_1, A_2, \dots, A_N)$ der Länge $N$, wobei jedes Element kleiner als $P$ ist. Sei $S = \{1, 2, \dots, N\}$.

Bestimme die Anzahl der Folgen $T$ von Mengen mit einer Länge von mindestens $1$, die alle folgenden Bedingungen erfüllen, und gib das Ergebnis modulo $P$ aus.

  • Jedes Element von $T$ ist eine nichtleere Teilmenge von $S$.
  • Für jedes $i = 1, 2, \dots, N$ gilt Folgendes:
    • Unter den Elementen von $T$ enthalten genau $A_i$ das Element $i$.

Eingabe

Die Eingabe erfolgt im folgenden Format:

N P
A_1 A_2 ... A_N
  • $1 \le N \le 2 \times 10^5$
  • $113 \le P \le 500009$
  • $P$ ist eine Primzahl
  • $1 \le A_i < P$ ($1 \le i \le N$)
  • Alle Eingabewerte sind ganze Zahlen

Ausgabe

Gib die Antwort aus.

Beispiele

2 113
1 2
5
4 8191
7 6 3 8
4477

Hinweis

Für das erste Beispiel sind die möglichen Folgen $T$ gleich $(\{1, 2\}, \{2\})$, $(\{2\}, \{1, 2\})$, $(\{1\}, \{2\}, \{2\})$, $(\{2\}, \{1\}, \{2\})$, $(\{2\}, \{2\}, \{1\})$, also insgesamt $5$.

Vergiss beim zweiten Beispiel nicht, die Anzahl der gültigen Folgen $T$ modulo $P$ zu berechnen.

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#1492EditorialOpen题解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.