List Minimum

View as PDF

Submit solution

Points: 4
Time limit: 2.0s
Memory limit: 256M

Problem types
Brute Force Practice 1

You have a list of unique numbers each no larger than 1\,000. The size of the list is no greater than 50. You perform the following operation on the list repeatedly: take the minimum of the numbers, and remove it from the list. You stop when the list is empty.

In what order are the numbers removed?

Input

The first line will have the size of the list.

Each line after that will be an element of the list. You are guaranteed no two elements are the same.

Output

Print one line for each time the operation was performed: the number that was removed at that step.

Sample Input

3
5
8
2

Sample Output

2
5
8

Comments


  • 0
    DA_BIG_MO  commented on Dec. 30, 2018, 10:09 p.m.

    take the minimum of the numbers, and remove it from the list. should it be the smallest?


    • 0
      IanHu  commented on Dec. 31, 2018, 7:03 p.m.

      yeah just each time find the current minimum number in the array and: print it(the smallest) & remove it


  • -28
    CoolNoobyBooby  commented on Sept. 26, 2018, 8:31 p.m. edited

    This comment is hidden due to too much negative feedback. Click here to view it.


  • 1
    Xyene  commented on Sept. 27, 2016, 3:40 p.m. edited

    A note to new users: please do not post notes, hints, or solutions in problem comments.

    What may seem obvious to you may not be obvious to others. There are many ways to solve problems like these, and they exist to encourage new contest programmers into thinking about the efficiency of their solutions. Posting a solution — no matter how trivial — defeats this purpose.


    • -8
      root  commented on Nov. 7, 2016, 12:11 p.m.

      This comment is hidden due to too much negative feedback. Click here to view it.


      • -1
        Xyene  commented on Nov. 8, 2016, 12:25 a.m.

        That's fine, and a good intuition for harder problems. However, 3-5 point problems should usually be taken at face value, as there are rarely any tricks involved.


    • 2
      Kirito  commented on Sept. 27, 2016, 4:13 p.m.

      Just to clarify, clarifications are allowed, right?


      • 2
        Xyene  commented on Sept. 27, 2016, 4:50 p.m.

        Of course, and even hints may be appropriate for harder problems, where a nudge towards the right approach isn't the same as giving the entire problem away.