Alice while chasing Mr. White rabbit in the wonderland reaches the Kingdom of hearts. There she meets a foul tempered lady, the Queen of hearts. The Queen herself was in a big trouble.
Queen said, "You little girl, how dare you come into my kingdom?" Alice said, "I am really sorry, I missed my way."
Queen: "Only the sorry will not do. I will give you a task and if you fail to do it, you will be beheaded."
The task is: The Queen has a few soldiers, each with a label on his head. The Queen also has three forts, now she needs to send these soldiers to these three forts. But there is a problem. Whenever two soldiers in a fort exist such that the sum of labels of two is equal to five times the label of any soldier in the fort (which might include the two soldiers whose labels are being added), they acquire a special power Tijihba. With this special power Tijihba, they will overthrow the Queen.
2007-02-02
22:29:18
·
9 answers
·
asked by
dont_trust_me
5
in
Entertainment & Music
➔ Jokes & Riddles
Now, The Queen gives Alice the number of her soldiers and asks her to divide them into three groups, each group to be sent to a different fort such that nobody gets the special power of Tijihba. Remember, if there are n soldiers, they are labeled from 1 to n and each one of them has a unique label. The queen knows that for any 1..n labels of soldiers, there is a way to divide them so that they would not be able to acquire the power of Tijihba.
Input
The first line gives the number of test cases, N. Each test case consists of a single positive integer 'n' on a new line. This means you have all soldiers labeled from 1 to n.
Output
For each test case,
The first line gives the number of soldiers, n.
The next line gives the number of soldiers in each of the three forts, 'a', 'b', 'c'.
The next line gives 'a' integers, which are the labels of the soldiers in fort 1.
The next line gives 'b' integers, which are the labels of the soldiers in fort 2.
2007-02-02
22:30:21 ·
update #1
The next line gives 'c' integers, which are the labels of the soldiers in fort 3.
Sample Input:
2
5
10
Sample Output:
5
1 3 1
1
3 4 5
2
10
6 3 1
1 6 7 8 9 10
3 4 5
2
2007-02-02
22:32:21 ·
update #2