Given two integers n and k, develop a stage an of numbers from 1 to n which has precisely k pinnacles. A file I of a cluster an of size n is supposed to be a pinnacle if 1ai−1 and ai>ai+1. Assuming such stage is unimaginable, print −1. Input The main line
Correct answer will be upvoted else downvoted. Computer science.
Given two integers n and k, develop a stage an of numbers from 1 to n which has precisely k pinnacles. A file I of a cluster an of size n is supposed to be a pinnacle if 1<i<n and
Input
The main line contains an integer t (1≤t≤100) — the number of experiments.
Then, at that point, t lines follow, each containing two space-isolated integers n (1≤n≤100) and k (0≤k≤n) — the length of an exhibit and the necessary number of pinnacles.
Output
Output t lines. For each experiment, assuming there is no stage with given length and number of pinnacles, print −1. In any case print a line containing n space-isolated integers which frames a stage of numbers from 1 to n and contains precisely k pinnacles.
Step by step
Solved in 3 steps with 1 images