416. Optimal Dartboard
Time limit per test: 0.25
second(s)
Memory limit: 262144
kilobytes
input: standard
output: standard
A dartboard is a disc divided into
n segments, with each segment labeled with a distinct positive integer between 1 and
n. That integer indicates the score for hitting the segment. To make the game more interesting, the arrangement of numbers is chosen in such a way that the risk is maximized. The risk is estimated based on the differences in scores of adjacent segments.
We're studying the following 'doublelayered' structure of segments in this problem:
I.e.,
n is always even, and we split the disc into two layers of
parts along the circumference. We enumerate the segments in the following manner: the first segment is some outer segment, the second segment is the corresponding inner segment, the third segment is some adjacent outer segment, etc. An example of this enumeration is shown on the picture above.
The total risk is defined as the sum of squared differences between the scores of adjacent segments. If the value assigned to segment
i is
a_{i}, then the risk is:
R=∑
_{i=1}^{n}(
a_{i}
a_{i+2})
^{2}+∑
_{i=1}^{n/2}(
a_{2i1}
a_{2i})
^{2}(we assume
a_{n+1}=a
_{1} and
a_{n+2}=a
_{2} in this formula).
You are to place the numbers from 1 through
n into the segments in such a way that the total risk
R is maximized.
Input
The input file contains an even integer number
n (6 ≤
n ≤ 100).
Output
Output
n integer numbers:
a_{1},
a_{2},...,
a_{n}, separated with single spaces. In case there are several possible solutions, output any.
Example(s)
sample input

sample output

10

2 9 7 4 6 5 3 8 10 1
