285A.md (1440B)
1 Source: https://codeforces.com/problemset/problem/285/A 2 3 A. Slightly Decreasing Permutations 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 Permutation *p* is an ordered set of integers *p*1, *p*2, ..., *p**n*, consisting of *n* distinct positive integers, each of them doesn't exceed *n*. We'll denote the *i*-th element of permutation *p* as *p**i*. We'll call number *n* the size or the length of permutation *p*1, *p*2, ..., *p**n*. 22 23 The decreasing coefficient of permutation *p*1, *p*2, ..., *p**n* is the number of such *i* (1 ≤ *i* < *n*), that *p**i* > *p**i* + 1. 24 25 You have numbers *n* and *k*. Your task is to print the permutation of length *n* with decreasing coefficient *k*. 26 27 Input 28 29 The single line contains two space-separated integers: *n*, *k* (1 ≤ *n* ≤ 105, 0 ≤ *k* < *n*) — the permutation length and the decreasing coefficient. 30 31 Output 32 33 In a single line print *n* space-separated integers: *p*1, *p*2, ..., *p**n* — the permutation of length *n* with decreasing coefficient *k*. 34 35 If there are several permutations that meet this condition, print any of them. It is guaranteed that the permutation with the sought parameters exists. 36 37 Examples 38 39 Input 40 41 ``` 42 5 2 43 ``` 44 45 Output 46 47 ``` 48 1 5 2 4 3 49 ``` 50 51 Input 52 53 ``` 54 3 0 55 ``` 56 57 Output 58 59 ``` 60 1 2 3 61 ``` 62 63 Input 64 65 ``` 66 3 2 67 ``` 68 69 Output 70 71 ``` 72 3 2 1 73 ```