## DMOPC '21 Contest 8 P3 - Weaker Data

View as PDF

Points: 25 (partial)
Time limit: 2.0s
Memory limit: 256M

Author:
Problem type

Two days before the contest, Keenan proposed the following lovely problem as the third problem of the DMOPC:

Given a permutation of the first positive integers, a valley is a triplet of indices such that . Count the number of valleys.

Unfortunately, it has neither flavourtext nor data. Now that Edward has finished with the flavourtext, it is your job to generate the data. Specifically, Keenan wants a case with a permutation of length where the answer is . Of course, it is also known that he has a peculiar obsession with lexicographically small permutations. Thus, you are to generate the lexicographically smallest permutation satisfying his desires, or determine that no such permutation exists.

#### Constraints

##### Subtask 3 [40%]

No additional constraints.

#### Input Specification

The first and only line of input contains space-separated integers and .

#### Output Specification

On a single line, output the lexicographically smallest permutation of the first integers with valleys, or -1 if none exist.

#### Scoring

You will receive 50% of the marks for a case if your permutation of length generates the desired output of but is not lexicographically minimum.

#### Sample Input 1

5 4

#### Sample Output 1

2 1 4 3 5

#### Explanation for Sample 1

The valleys are , , , and . It can be proven that this arrangement is lexicographically minimum.

#### Sample Input 2

4 100

#### Sample Output 2

-1

#### Sample Input 3

10 20

#### Sample Output 3

1 2 3 7 9 5 4 6 8 10

## Comments

There are no comments at the moment.