#K14891. Maximize Absolute Difference
Maximize Absolute Difference
Maximize Absolute Difference
You are given an integer \( N \) representing the length of the sequence. Your task is to produce a permutation of the sequence \( [1, 2, \ldots, N] \) such that the sum of absolute differences between consecutive elements is maximized.
A simple greedy strategy is to alternate between the smallest and largest remaining numbers. For example, when \( N = 5 \), one optimal permutation is \( [1, 5, 2, 4, 3] \), and when \( N = 4 \), an optimal permutation is \( [1, 4, 2, 3] \).
Note: If there are several valid answers, outputting any one of them is acceptable.
inputFormat
The input consists of a single integer \( N \) (\(1 \leq N \leq 10^5\)), which represents the length of the sequence.
outputFormat
Output the permutation of numbers from \(1\) to \(N\) that maximizes the sum of absolute differences between adjacent elements. The numbers should be printed in a single line separated by a single space.
## sample1
1