CS240 project Problem 1
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
Description
Given two positive integers and , find the lexicographically smallest permutation of the integers which satisfies the following condition:
Note: A sequence is lexicographically smaller than another sequence if there exists such that for all , and . For example, is lexicographically smaller than , which is lexicographically smaller than .
Format
Input
Two numbers ,
Output
Print the lexicographically smallest permutation of the integers which satisfies the above condition, in the format .
If there is no such permutation, print .
Samples
3 1
2 3 1
Two permutations satisfy the condition, (2,3,1) and (3,1,2). For instance, for (2, 3, 1) we have:
8 3
4 5 6 7 8 1 2 3
8 6
-1
Limitation