## List Minimum (Hard)

View as PDF

Points: 5
Time limit: 0.4s
Racket 1.0s
Memory limit: 256M

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig
##### Brute Force Practice 1 — Hard Version

You have a list of unique numbers each no larger than . The size of the list is no greater than . 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

• commented on Sept. 14, 2020, 5:48 a.m.

Wait, is this not the same problem as List Minimum (https://dmoj.ca/problem/bf1)? The instructions are worded differently, but the problem seems the same. I even used the same code for both. Could someone explain this?

• commented on Sept. 14, 2020, 9:58 a.m. edited

The constraints of the problems are different. The ones in this problem are a lot larger than the other one, so some solutions (not yours apparently) that may AC the other one may fail this one.

• commented on Sept. 25, 2020, 3:32 a.m.

like mine

• commented on Sept. 15, 2020, 12:55 a.m.

Ah, that clears things up, Thank you!

• commented on Jan. 18, 2019, 10:38 p.m.

is it me or does it take a long time to process?

• commented on Oct. 28, 2017, 11:13 p.m. edited

Could anyone help me out? When I run my code on eclipse oxygen it works fine but when I submit it says invalid return and java.lang.NullPointerException

EDIT: I fixed the issue, still not quite sure what caused it. However, even while using BufferedReader the last case is still giving me TLE, not sure what I can do about that...

• commented on Oct. 29, 2017, 12:32 a.m. edited

Reading the tips section at https://dmoj.ca/tips/ may provide some hints. (It's not reading the input that's causing the TLE).

• commented on Oct. 22, 2016, 8:26 p.m. edited

To deal with input/output, you may want to add this to your program:

(void (map displayln (my-sort (build-list (read) (lambda (x) (read))) <)))

• commented on Nov. 14, 2014, 10:57 a.m.

For Java users getting TLE on the last case, reading this might be helpful.

• commented on Oct. 9, 2018, 7:54 p.m.

Thx a lot