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)$ ปรากฏเป็นลำดับย่อยของ $A$ เป็นจำนวน $X$ ครั้งพอดี กล่าวอีกนัยหนึ่งคือ มีวิธีเลือกดัชนี $1 \le i_1 < i_2 < \dots < i_N \le 2N$ ที่ทำให้ $A_{i_j} = j$ $(1 \le j \le N)$ อยู่ $X$ วิธีพอดี

หากมีลำดับดังกล่าว ให้แสดงผลออกมาหนึ่งลำดับ หากมีลำดับดังกล่าวหลายลำดับ ให้แสดงผลลำดับใดลำดับหนึ่งก็ได้

ข้อมูลนำเข้า

ข้อมูลนำเข้าประกอบด้วยหลายกรณีทดสอบในรูปแบบต่อไปนี้

$$ \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.