#P4903. Maximizing Shattered Pieces

    ID: 18144 Type: Default 1000ms 256MiB

Maximizing Shattered Pieces

Maximizing Shattered Pieces

CYD's heart can be modeled as an annulus with two sets of N equally spaced points on its outer and inner boundaries, respectively. When he sees the ith hole, he recalls the Ai-th memory, leaving a scar that connects the outer ith point and the inner Ai point. The scar is drawn in a specific direction: clockwise if \(i A_i\), and directly (radially) if \(i = A_i\).

Your task is to determine a permutation \(A\) of \(\{1, 2, \ldots, N\}\) such that the number of regions (pieces) into which the heart is split is maximized. It can be shown that the maximum number of regions is achieved when every scar (i.e. line) intersects every other scar. This happens when \(A\) is the reverse of the natural order, that is, \(A_i = N - i + 1\) for \(1 \le i \le N\).

inputFormat

The input consists of a single integer \(N\) (\(1 \le N \le 10^5\)), representing the number of points on each boundary.

outputFormat

Output \(N\) space-separated integers representing the permutation \(A\) that maximizes the number of shattered pieces. It is optimal to output the reverse order: \(N, N-1, \ldots, 1\).

sample

1
1