#K50442. Zigzag Artwork Sequence
Zigzag Artwork Sequence
Zigzag Artwork Sequence
Given a positive integer \(n\), generate a permutation of the integers \(0\) to \(n-1\) that forms a zigzag pattern. In other words, for every odd index \(i\) (where \(1 \le i \le n-2\)), the sequence must satisfy:
[ \text{sequence}[i-1] < \text{sequence}[i] > \text{sequence}[i+1] ]
For example, if \(n = 5\), one valid zigzag sequence is:
[ 0\quad 2\quad 1\quad 4\quad 3 ]
Your task is to produce such a sequence. If \(n\) is small, the generated sequence may not be unique. However, the produced sequence must satisfy the zigzag property.
inputFormat
The input consists of a single integer \(n\) (\(1 \le n \le 10^5\)) read from standard input.
outputFormat
Output the generated zigzag sequence as space-separated integers on a single line to standard output.
## sample5
0 2 1 4 3
</p>