問題一覧 > 通常問題

No.1528 Not 1

レベル : / AI推定難易度 : 725 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / スペシャルジャッジ問題 (複数の解が存在する可能性があります)
タグ : (AC するまで非表示) / 解いたユーザー数 212
作問者 : PCTprobability / テスター : tatyam 👑 hamamu
お気に入りにしたユーザー ProblemId : 6361 / 自分の提出
問題文最終更新日: 2021-06-04 19:37:16
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 298 (順位表) の他の問題:

Problem Statement

Construct a sequence of positive integers $A_1,A_2,...,A_{\left\lceil \frac{N}{2} \right\rceil}$ of length $\displaystyle \left\lceil \frac{N}{2} \right\rceil$ that satisfies the following conditions. If no sequence satisfying the conditions exists, report that fact.

  • $1 \le A_i \le N$
  • If $i \neq j$, then $A_i \neq A_j$
  • $\mathrm{gcd}(A_i,A_{i+1}) \neq 1\ (1 \le i \le \displaystyle \left\lceil \frac{N}{2} \right\rceil -1)$

Here, $\displaystyle \lceil x \rceil$ denotes the smallest integer greater than or equal to the real number $x$.

Input

$N$

  • All inputs are integers.
  • $1 \le N \le 2 \times 10^5$

Output

If no sequence of positive integers satisfying the conditions exists, print $-1$.

If a sequence of positive integers satisfying the conditions exists, print such a sequence separated by spaces, as follows.

If there are multiple solutions, you may print any of them.

$A_1\ A_2\ \dots\ A_{\left\lceil \frac{N}{2} \right\rceil}$

Sample

Sample 1
Input
11
Output
3 9 6 2 10 5

All elements are at most $11$ and distinct, and since $\mathrm{gcd}(3,9)=3,\mathrm{gcd}(9,6)=3,\mathrm{gcd}(6,2)=2,\mathrm{gcd}(2,10)=2,\mathrm{gcd}(10,5)=5$, the conditions are satisfied.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。