QOJ.ac

QOJ

时间限制: 1 s 内存限制: 1024 MB 总分: 100 可 Hack ✓

#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$ 之间(包含 $N+1$ 和 $2N$)。长度为 $k$ 的序列的中位数定义为:若 $k$ 为奇数,则为第 $\frac{k+1}{2}$ 小的数;若 $k$ 为偶数,则为第 $\frac{k}{2}$ 小的数与第 $\frac{k}{2}+1$ 小的数的算术平均值。

第一行输入一个整数 $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.