QOJ.ac

QOJ

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

#18590. ibasic Sequences

الإحصائيات

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.