Page Contents

## Positive AND SOLUTIONS POSAND OCTOBER CHALLENGE 2020

A permutation p1,p2…pN of {1,2,…,N} is beautiful if pi&pi+1 is greater than 0 for every 1≤i<N . You are given an integer N, and your task is to construct a beautiful permutation of length N or determine that it’s impossible.

Note that a&b denotes the bitwise AND of a and b.

Input:

First line will contain T, number of testcases. Then the testcases follow. Each testcase contains a single line of input, an integer N.

Output:

For each test case output −1 if there is no suitable permutation of length N, otherwise output N integers in a single line which form a beautiful permutation. If there are multiple answers output any of them.

Constraints

1≤N≤105

The sum of N over all test cases does not exceed 106

Subtasks

50 points : 1≤N,T≤9

50 points : Original constraints

Sample Input:

3

4

3

5

Sample Output:

-1

1 3 2

2 3 1 5 4

Solution is not available in given link.

Within few days we are going to release the logic for all the questions at once, so please be patience and keep coding, your really working hard.

These are questions from codechef october long challenges, I needed to see the logic not just the question.

We apologize for the delay, it seems team members are busy with there college exams and placement training, we know it's a 10 day long challenge thinking that people will try there best and mean while we will finish our works. We received lots of solution videos which we don't want to publish as contest is LIVE but we also got lots of logic sharing videos and we will be uploading them one by one today.

Thanks for your understanding. Keep Coding Your the Best.