#C5619. Lexicographically Smallest Array
Lexicographically Smallest Array
Lexicographically Smallest Array
You are given an array of integers and are allowed to reverse any subarray any number of times. Your task is to obtain the lexicographically smallest array possible.
It can be proven that by reversing subarrays you can transform the array into its sorted (non-decreasing) order. Therefore, the answer is simply the sorted version of the input array.
Constraints: The first integer denotes the number of elements N, followed by N space-separated integers.
inputFormat
The input is provided via standard input (stdin) in a single line. The first number is an integer N representing the size of the array, followed by N space-separated integers.
outputFormat
Output the lexicographically smallest array (i.e. the sorted array) to standard output (stdout). The elements should be printed in non-decreasing order and separated by spaces.
## sample5 3 1 4 1 5
1 1 3 4 5