Heaps: coding problems
Write a program that reads the input and prints the answer. Run checks it against every test, including hidden ones.
0 of 7 solved
A courier company weighs every parcel in a batch. The dispatcher wants the three lightest parcels on the first van, so it needs their weights in order, lightest first.
Read the weights and print the three smallest, in ascending order. Two parcels can weigh the same, and each one counts separately.
**Constraints:** 3 <= n <= 800. Each weight is an integer from -1000000000 to 1000000000. The whole input is at most 10,000 characters.
Input. First line n. Second line n integers, the parcel weights.
Output. One line: the three smallest weights in ascending order, separated by single spaces.
Example 1 input
5 7 2 9 2 5
Output
2 2 5
Example 2 input
4 -1 -5 3 0
Output
-5 -1 0