Unique Chance
Limits: 2 sec., 256 MiB
— The best price, only $\(x\), permutation \(P\) of \(N\) elements such that among numbers \(P_i+i\) there are exactly \(K\) distinct values.
— Pfff, I can create such.
Help Zenyk and find such permutation. If there exist several possible permutations print any of them.
Input
First line of the input contains 2 integers \(N\) and \(K\).
Output
Print permutation that satisfies above conditions. If there exist several possible permutations print any of them.
Constraints
\(1 \le K \le N \le 10^5\).
Samples
Input (stdin) | Output (stdout) |
---|---|
4 2 | 3 4 1 2 |
Notes
In sample test case
\(P_1+1=4\)
\(P_2+2=6\)
\(P_3+3=4\)
\(P_4+4=6\).
There are 2 distinct values \(4\) and \(6\).
Source: LNU Penguins Contest 6
Submit a solution
Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
---|
Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
---|