300258: CF49C. Disposition

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Disposition

题意翻译

Vasya 喜欢 Berland 的一位著名的诗人 Petya,今天 Vasya 买下了他的作品集。 Petya 的作品集共有 $n$ 卷,我们将其卷号编为 $1 \sim n$。由于 Petya 认为“如此伟大的作品,仅仅按照顺序来编排是远远不足的”,他希望按照**支配数最小**的方式排列。数字 $i$ 是支配数,当且仅当存在一个正整数 $j$($1 \leq j \leq n$),满足: - $j \bmod i=0$ - $p(j) \bmod i=0$ 其中 $p(j)$ 是按此规则排列好后的第 $j$ 卷书的编号。 请输出支配数最小的一种排列方案。 ## 输入 一个正整数 $n$,表示书的卷数。 ## 输出 $n$ 个正整数,代表支配数最小的排列方案,若有多组满足要求的数据,输出任意一组即可。

题目描述

Vasya bought the collected works of a well-known Berland poet Petya in $ n $ volumes. The volumes are numbered from $ 1 $ to $ n $ . He thinks that it does not do to arrange the book simply according to their order. Vasya wants to minimize the number of the disposition’s divisors — the positive integers $ i $ such that for at least one $ j $ ( $ 1<=j<=n $ ) is true both: $ j $ $ mod $ $ i=0 $ and at the same time $ p(j) $ $ mod $ $ i=0 $ , where $ p(j) $ is the number of the tome that stands on the $ j $ -th place and $ mod $ is the operation of taking the division remainder. Naturally, one volume can occupy exactly one place and in one place can stand exactly one volume. Help Vasya — find the volume disposition with the minimum number of divisors.

输入输出格式

输入格式


The first line contains number $ n $ ( $ 1<=n<=100000 $ ) which represents the number of volumes and free places.

输出格式


Print $ n $ numbers — the sought disposition with the minimum divisor number. The $ j $ -th number ( $ 1<=j<=n $ ) should be equal to $ p(j) $ — the number of tome that stands on the $ j $ -th place. If there are several solutions, print any of them.

输入输出样例

输入样例 #1

2

输出样例 #1

2 1 

输入样例 #2

3

输出样例 #2

1 3 2 

Input

题意翻译

Vasya 喜欢 Berland 的一位著名的诗人 Petya,今天 Vasya 买下了他的作品集。 Petya 的作品集共有 $n$ 卷,我们将其卷号编为 $1 \sim n$。由于 Petya 认为“如此伟大的作品,仅仅按照顺序来编排是远远不足的”,他希望按照**支配数最小**的方式排列。数字 $i$ 是支配数,当且仅当存在一个正整数 $j$($1 \leq j \leq n$),满足: - $j \bmod i=0$ - $p(j) \bmod i=0$ 其中 $p(j)$ 是按此规则排列好后的第 $j$ 卷书的编号。 请输出支配数最小的一种排列方案。 ## 输入 一个正整数 $n$,表示书的卷数。 ## 输出 $n$ 个正整数,代表支配数最小的排列方案,若有多组满足要求的数据,输出任意一组即可。

加入题单

算法标签: