QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 128 MB Total points: 100

#11156. 考试

Statistics

Byteoni 教授正在准备《位与字节理论》考试。他已经准备了 $n$ 道题目。教授为每道题目都评定了一个预期的难度系数。这个系数是一个从 $1$ 到 $n$ 的自然数。每道题目的系数各不相同。

现在,教授正在考虑考试题目的顺序。教授希望确定他的学生是否能够自行判断题目的难度。为此,他计划将题目按某种顺序排列,使得相邻题目的难度系数之差至少为 $k$。请帮助教授找到这样一个序列。

输入格式

输入的第一行包含两个整数 $n$ 和 $k$ ($2 \le n \le 1\,000\,000$, $1 \le k \le n$):表示教授准备的题目数量以及相邻考试题目难度系数的最小差值。

输出格式

你的程序应输出一行,包含所求的题目难度系数序列,即一个由 $1$ 到 $n$ 之间两两不同的自然数组成的序列,其中任意两个相邻数字之差的绝对值至少为 $k$。如果存在多个正确的答案,输出其中任意一个即可。如果不存在满足条件的序列,你的程序应仅输出一个单词:NIE(波兰语,意为“不”)。

样例

输入 1

5 2

输出 1

2 4 1 5 3

输入 2

5 4

输出 2

NIE

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.