codeforces 482 A. Diverse Permutation(构造)

C – C

Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u

Submit Status

Description

Permutationp is an ordered set of integers p1,   p2,   …,   pn, consisting of n distinct positive integers not larger than n. We’ll denote asn the length of permutation p1,   p2,   …,   pn.

Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, …, |pn - 1 - pn| has exactly k distinct elements.

Input

The single line of the input contains two space-separated positive integers nk (1 ≤ k < n ≤ 105).

Output

Print n integers forming the permutation. If there are multiple answers, print any of them.

Sample Input

Input

Output

Input

Output

Input

Output

Hint

By |x| we denote the absolute value of number x.

 

 

题意是说找到找到一组n个由1..n组成的数列,且每个数字只出现一次

满足每相邻的两项的差的绝对值一共有k种。

 

找规律即可。不好描述,直接上代码吧。

作者: CrazyKK

ex-ACMer@hust,researcher@sensetime

说点什么

您将是第一位评论人!

提醒
wpDiscuz