Finding a Dongga Sequence
Time limit1sMemory limit1024 MB
Given N, print any permutation of 1 to N where each pair of adjacent values differs by at least floor(N/2).
- Level
Medium4 of 10
- Topics
- Array, Math, Implementation
- Solved
- No attempts yet
Problem
A dongga sequence of length is a sequence that satisfies the following two conditions.
- It consists of integers from to , and all elements are distinct.
- The difference between adjacent elements is at least .
Find any one dongga sequence of length . For every valid input, a dongga sequence always exists.
Input
The first line contains (), the length of the dongga sequence to find.
Output
On the first line, print any one dongga sequence of length . Separate the elements with spaces.
Hint
is the largest integer not greater than .