Forgot Password ?
New password will be sent to following email id
Chotu and Rose Day
Problem Code : ROSE
2 6 6 2 1 3 2 1 3 1 1 1
6 1 3 2 1
Time Limit :
C , C++ , Java , Python 2
Login to submit your response.
Valentine week has started and Chotu wants to impress his crush. On this rose day Chotu plans to give his crush a bouquet of roses. Chotu visits a rose shop which has <b>N</b> number of roses and each rose has a certain love factor. Now Chotu wants to make a bouquet with maximum number of roses. As Chotu’s crush is very selective, she will only accept the bouquet if it contains roses with distinct love factors. To make the bouquet attractive Chotu wants to arrange roses in the following order. He will first choose rose with the largest love factor followed by the rose with smallest love factor followed by rose with 2<sup>nd</sup> largest love factor followed by the rose with 2<sup>nd</sup> smallest love factor and so on. <br> Help Chotu to design the bouquet.
First line contains integer <b>T</b> denoting number of testcases.<br> Second line contains integer <b>N</b> denoting number of roses. <br> Next line contains <b>N</b> integers separated by a single space denoting love factor.
For each test case print answer in single line in the format explained above.
1 <= <b>T</b> <= 10 <br> 1 <= <b>N</b> <= 10<sup>5</sup> <br> 1 <= <b>Love factor of roses</b> <= 10<sup>6</sup>
In first test case, the distinct roses available are 6 2 1 3. So chotu will make bouquet in following order : 6 1 3 2 <br><br> In second test case there is only one distinct rose with love factor 1. So he can form a bouquet with only one rose.