2015 PSUT Coding Marathon |
---|
Finished |
The imbalance value of last year was too large. Therefore, Dr. Saqr asked you to implement a program that produces a teams formation with the minimum possible imbalance value.
The first line of input contains an integer N (1 ≤ N ≤ 50) representing the number of teams.
The second line contains 2N space-separated integers; each representing the grade of one student.
Print the 2N integers, such that if every two consecutive students formed a team, the imbalance value would be the minimum possible.
If there is more than one possible solution, print any of them.
2
23 36 28 8
8 36 23 28
3
26 48 16 24 9 8
8 48 9 26 16 24
Name |
---|