QOJ.ac

QOJ

Time Limit: 2.0 s Memory Limit: 2048 MB

#22847. מציאת יוטות

Statistics

נתונים מספר שלם חיובי $N$ ומספר שלם אי-שלילי $X$.

קבעו האם קיימת סדרה $A = (A_1, A_2, \dots, A_{2N})$ באורך $2N$ המקיימת את כל התנאים הבאים:

  • כל מספר שלם מ-$1$ ועד $N$ מופיע ב-$A$ בדיוק פעמיים.
  • הסדרה $(1, 2, \dots, N)$ מופיעה בדיוק $X$ פעמים כתת-סדרה של $A$. במילים אחרות, ישנן בדיוק $X$ דרכים לבחור אינדקסים $1 \le i_1 < i_2 < \dots < i_N \le 2N$ כך שמתקיים $A_{i_j} = j$ $(1 \le j \le N)$.

אם קיימת סדרה כזו, הדפיסו אחת כזו. אם קיימות מספר סדרות כאלו, הדפיסו אחת מהן כלשהי.

קלט

הקלט מורכב ממספר מקרי בדיקה בפורמט הבא:

$$ \begin{aligned} &T \\ &\mathrm{case}_1 \\ &\mathrm{case}_2 \\ &\vdots \\ &\mathrm{case}_T \end{aligned} $$

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

$$ N \ X $$

השורה הראשונה מכילה מספר שלם $T$ $(1 \le T \le 2 \times 10^5)$, מספר מקרי הבדיקה.

עבור כל מקרה בדיקה, נתונים מספר שלם חיובי $N$ $(1 \le N \le 2 \times 10^5)$ ומספר שלם אי-שלילי $X$ $(0 \le X \le 10^{18})$.

סכום ערכי $N$ על פני כל מקרי הבדיקה אינו עולה על $2 \times 10^5$.

פלט

עבור כל מקרה בדיקה, אם אין סדרה המקיימת את התנאים, הדפיסו No בשורה נפרדת.

אחרת, הדפיסו Yes בשורה הראשונה, והדפיסו $2N$ מספרים שלמים $A_1, A_2, \dots, A_{2N}$ המייצגים סדרה המקיימת את התנאים בשורה השנייה.

אם ישנן מספר סדרות תקפות, ניתן להדפיס כל אחת מהן.

דוגמאות

קלט 1

3
2 3
50 1000000000000000000
4 0

פלט 1

Yes
1 2 1 2
No
Yes
4 4 3 3 2 2 1 1

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.