#B. CS240 project Problem 1

    传统题 1000ms 256MiB

CS240 project Problem 1

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

Description

Given two positive integers NN and KK, find the lexicographically smallest permutation of the integers 1,,N1, \ldots, N which satisfies the following condition:

AiiK for all 1iN.|A_i - i| \geq K \text{ for all } 1\leq i\leq N.

Note: A sequence v1,...,vNv_1, ..., v_N is lexicographically smaller than another sequence v1,...,vNv'_1, ..., v'_N if there exists 1iN1 \leq i \leq N such that vj=vjv_j = v'_j for all 1j<i1 \leq j < i, and vi<viv_i < v'_i. For example, (1,2,3)(1,2,3) is lexicographically smaller than (2,1,3)(2, 1, 3), which is lexicographically smaller than (2,3,1)(2,3,1).

Format

Input

Two numbers NN, KK

Output

Print the lexicographically smallest permutation of the integers 1,,N1, \ldots, N which satisfies the above condition, in the format A1A2ANA_1 \, A_2 \, \dots \, A_N.

If there is no such permutation, print 1-1.

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:

A11=1K|A_1 - 1| = 1 \geq K

A22=1K|A_2 - 2| = 1 \geq K

A33=2K|A_3 - 3| = 2 \geq K

8 3
4 5 6 7 8 1 2 3
8 6
-1

Limitation

2N3×1052\leq N\leq 3\times 10^5

1KN11\leq K\leq N-1

CS240 project Problem

未参加
状态
已结束
规则
IOI
题目
5
开始于
2023-5-16 10:00
结束于
2023-6-6 23:59
持续时间
518 小时
主持人
参赛人数
92