#P8976. Construct a Permutation with Half‐Sums Constraints

    ID: 22137 Type: Default 1000ms 256MiB

Construct a Permutation with Half‐Sums Constraints

Construct a Permutation with Half‐Sums Constraints

You are given an even integer \(n\) and two integers \(a\) and \(b\). Your task is to construct a permutation \(p\) of length \(n\) (i.e. a rearrangement of \(\{1,2,\ldots,n\}\)) such that

\[ \sum_{i=1}^{n/2} p_i \ge a \quad\text{and}\quad \sum_{i=n/2+1}^{n} p_i \ge b. \]

If there are multiple answers, print any valid permutation. It is guaranteed that \(a\) and \(b\) are chosen so that a solution exists.

Note: All formulas are written in \(\LaTeX\) format.

inputFormat

The input consists of a single line containing three space-separated integers: \(n\) (an even number), \(a\), and \(b\).

outputFormat

Output any valid permutation of \(\{1, 2, \ldots, n\}\) (i.e. \(n\) distinct integers) such that the sum of the first \(n/2\) numbers is at least \(a\) and the sum of the last \(n/2\) numbers is at least \(b\). The numbers should be output in a single line separated by spaces.

sample

4 3 3
1 2 3 4