QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 256 MB

#21387. ปัญหาการสร้างอย่างง่าย

Statistics

สำหรับจำนวนเต็มบวก $n$ ลำดับที่มีความยาว $n$ จะถูกเรียกว่า “ลำดับอิฐแดง” หากสอดคล้องกับเงื่อนไขต่อไปนี้:

  • แต่ละจำนวนใน $1, 2, \ldots, n$ ปรากฏในลำดับเพียงครั้งเดียวเท่านั้น
  • ผลรวมของทุกคู่ของสมาชิกที่อยู่ติดกันไม่เป็นกำลังสองสมบูรณ์

กำหนดจำนวนเต็ม $n$ จงสร้างลำดับอิฐแดงที่มีความยาว $n$

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

บรรทัดแรกประกอบด้วยจำนวนเต็ม $T$ ($1 \le T \le 10^4$) คือจำนวนชุดข้อมูลทดสอบ

สำหรับแต่ละชุดข้อมูลทดสอบ บรรทัดเดียวประกอบด้วยจำนวนเต็ม $n$ ($1 \le n \le 4 \times 10^6$) คือความยาวของลำดับอิฐแดงที่ต้องการ

รับประกันว่าผลรวมของ $n$ ไม่เกิน $4 \times 10^6$ สามารถพิสูจน์ได้ว่ามีคำตอบเสมอภายใต้ข้อจำกัดที่กำหนด

ข้อมูลส่งออก

แสดงผล $T$ บรรทัด โดยแต่ละบรรทัดประกอบด้วยลำดับที่สร้างขึ้น หากมีหลายคำตอบ ให้แสดงคำตอบใดก็ได้

ตัวอย่าง

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

5
1
2
3
4
5

ข้อมูลส่งออก 1

1
1 2
1 2 3
1 2 3 4
1 4 2 3 5

หมายเหตุ

สำหรับ $n = 5$ หากลำดับที่ส่งออกคือ 1 2 3 4 5 จะเป็นคำตอบที่ผิด เพราะ $4 + 5 = 9$ เป็นกำลังสองสมบูรณ์

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.