Universal Cup Judging System

Universal Cup

Süre Sınırı: 4.0 s Bellek Sınırı: 1024 MB Toplam puan: 100 Hack'lenebilir ✓
İstatistikler

תיאור

נתונים מספר שלם חיובי $N$, מספר ראשוני $P$, וסדרה של מספרים שלמים חיוביים $A = (A_1, A_2, \dots, A_N)$ באורך $N$, שבה כל איבר קטן מ-$P$. תהי $S = \{1, 2, \dots, N\}$.

מצאו את מספר סדרות הקבוצות $T$ באורך $1$ לפחות המקיימות את כל התנאים הבאים, והדפיסו את התוצאה מודולו $P$.

  • כל איבר של $T$ הוא תת-קבוצה לא ריקה של $S$.
  • עבור כל $i = 1, 2, \dots, N$, מתקיים התנאי הבא:
    • מבין האיברים של $T$, בדיוק $A_i$ מהם מכילים את $i$.

קלט

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

N P
A_1 A_2 ... A_N
  • $1 \le N \le 2 \times 10^5$
  • $113 \le P \le 500009$
  • $P$ הוא מספר ראשוני
  • $1 \le A_i < P$ ($1 \le i \le N$)
  • כל ערכי הקלט הם מספרים שלמים

פלט

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

דוגמאות

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

הערה

עבור הדוגמה הראשונה, הסדרות האפשריות $T$ הן $(\{1, 2\}, \{2\})$, $(\{2\}, \{1, 2\})$, $(\{1\}, \{2\}, \{2\})$, $(\{2\}, \{1\}, \{2\})$, $(\{2\}, \{2\}, \{1\})$, ובסך הכול $5$.

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

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.