#C9718. Maximize Score Sequence

    ID: 53842 Type: Default 1000ms 256MiB

Maximize Score Sequence

Maximize Score Sequence

You are given a single integer n. Your task is to generate a sequence of n distinct integers chosen from the range \(1\) to \(10^9\) such that the score, which Bob can obtain by swapping adjacent numbers, is maximized. Although the exact scoring mechanism is not described, one optimal strategy is to alternate between the smallest available number and the largest available number.

More formally, given an integer \(n\), construct a sequence \(a_1, a_2, \ldots, a_n\) where:

  • The numbers are distinct and each lies in the interval \([1, 10^9]\).
  • The sequence is arranged by taking the smallest and largest remaining numbers in alternating order.

For example:

  • For \(n = 2\), one optimal sequence is: \(1, 10^9\).
  • For \(n = 3\), one optimal sequence is: \(1, 10^9, 2\).
  • For \(n = 4\), one optimal sequence is: \(1, 10^9, 2, 10^9-1\).

You need to implement a program that reads the input from stdin and prints the resulting sequence to stdout with the numbers separated by a single space.

inputFormat

The input consists of a single line containing one integer \(n\) \((2 \le n \le 10^5)\).

outputFormat

Output the sequence of \(n\) distinct integers separated by a single space, which maximizes the swapping score as described.

Note: It is guaranteed that one optimal solution is to alternate between the smallest and largest remaining numbers.

## sample
2
1 1000000000

</p>