You are viewing a single comment's thread. Return to all comments →
Pretty simple implementation in Python3
#!/bin/python3 for _ in range(int(input().strip())): n, k = [int(x) for x in input().strip().split(' ')] if k != 0 and n % k != 0: print(-1) continue arr = [None] * (n+1) # initialize iterable for i in range(1,len(arr)): if arr[i] is None: arr[i] = i + k arr[i+k] = i print(' '.join([str(j) for j in arr[1:]]))
Seems like cookies are disabled on this browser, please enable them to open this website
Absolute Permutation
You are viewing a single comment's thread. Return to all comments →
Pretty simple implementation in Python3