List Minimum

View as PDF

Submit solution

Points: 3
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 Specification

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 Specification

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
    otoya  commented on Jan. 24, 2024, 6:37 p.m.

    ez pq


  • 12
    dmojme  commented on Feb. 25, 2021, 3:41 a.m.

    Isn't this basically the same as https://dmoj.ca/problem/a4b1 ?


  • 1
    DA_BIG_MO  commented on Dec. 31, 2018, 3:09 a.m.

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


    • 0
      Chad_Li1  commented on July 15, 2022, 1:59 a.m.

      It should be the smallest in that current list. I think, I can't figure it out.


    • 3
      IanHu  commented on Jan. 1, 2019, 12:03 a.m.

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


  • -57
    CoolNoobyBooby  commented on Sept. 27, 2018, 12:31 a.m. edited

    This comment is hidden due to too much negative feedback. Show it anyway.


  • 3
    Xyene  commented on Sept. 27, 2016, 7: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.


    • -4
      root  commented on Nov. 7, 2016, 5:11 p.m.

      I just thought this problem is suspiciously simple. The general rule for me is "when you find it too easy, then you have misread the problem"


      • 0
        Xyene  commented on Nov. 8, 2016, 5: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.


    • 7
      Kirito  commented on Sept. 27, 2016, 8:13 p.m.

      Just to clarify, clarifications are allowed, right?


      • 6
        Xyene  commented on Sept. 27, 2016, 8: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.