0139. Simple Sorting

Input file name: sort.in
Output file name: sort.out
Time limit: 1 s
Memory limit: 64 megabytes

You are given an unsorted array of 32-bit integer numbers. Your task is to sort this array and kill possible duplicated elements occuring in it.

Input file

The first line of the input file contains an integer number N representing the quantity of numbers in this array (1 ≤ N ≤ 65536). Next N lines contain N 32-bit integer numbers (one number per each line) of the original array.

Output file

Output file should contain at most N numbers sorted in descending order if the value of N was even, otherwise the numbers are to be sorted in ascending order. Every number in the output file should occure only once.

Examples:

sort.insort.out
6 8 8 7 3 7 78 7 3


Source: Petrozavodsk Summer 2003. Blitz Kontest, Monday, August 25
Author: Andrew Lopatin, Nick Durov

Discuss       Submit a solution



Printable version