QOJ.ac

QOJ

حد الوقت: 1 s حد الذاكرة: 1024 MB مجموع النقاط: 100 قابلة للهجوم ✓

#18590. ibasic 序列

الإحصائيات

為了繼承 ian0704 的意志,請為 ibasic 找出一個長度為 $3N$ 的數列 $A$,使其滿足以下所有條件:

  • $A$ 是一個由 $1$ 到 $3N$ 的整數各出現一次的排列。
  • 對於所有滿足 $1\le l< r\le 3N$ 的 $l$ 與 $r$,區間 $[A_l,A_{l+1},\dots,A_r]$ 的中位數必須大於或等於 $N+1$ 且小於或等於 $2N$。長度為 $k$ 的數列,若 $k$ 為奇數,其中位數為第 $\frac{k+1}{2}$ 小的數;若 $k$ 為偶數,其中位數為第 $\frac{k}{2}$ 小的數與第 $\frac{k}{2}+1$ 小的數之和除以 $2$ 的值。

第一行輸入一個整數 $N$。$(1\le N\le 10^5)$

第一行輸出一個滿足條件的數列 $A_1,A_2,\dots,A_{3N}$,數字之間以空白分隔。若不存在滿足條件的數列,則輸出 -1。若存在多種可能的數列,輸出其中任意一個即可。

範例

輸入格式 1

2

輸出格式 1

1 5 3 4 2 6

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.