Miracle Sort

View as PDF

Submit solution

Points: 3
Time limit: 5.0s
Memory limit: 6M
Python 10M

Author:
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

How to sort.

Input Specification

On the first line, an integer N (1 \le N \le 1\,000\,000). On the following N lines, there will be a sequence of N numbers, with each number between -2^{63} and 2^{63}-1.

Output Specification

Using a line break as a separator between numbers, print out the sequence from the input, in sorted order.


Comments


  • 2
    Tomorrow  commented on July 15, 2020, 5:28 p.m. edited

    For those who spend lots of effort on this problem but still cannot pass, this page might give you an idea about the nature of this problem.


  • 3
    OneYearOld  commented on July 8, 2020, 9:47 a.m. edited

    Even if you implement the intended solution, you will get an MLE if you use Python.

    edit: you can AC on Python now.


  • 6
    Plasmatic  commented on Feb. 2, 2019, 10:19 p.m. edit 2

    what a miracle... this is truly a miracle-based sorting algorithm


    • -2
      yaxollum  commented on Feb. 2, 2019, 10:36 p.m.

      what is the miracle?


  • 0
    yaxollum  commented on Jan. 31, 2019, 8:00 p.m.

    What sorting algorithm am I supposed to use with only 6MB of RAM?


  • -6
    Arihan10  commented on Jan. 29, 2019, 4:15 p.m.

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


    • 8
      TimothyW553  commented on Jan. 29, 2019, 5:22 p.m.

      Try this and tell me what you get

      4
      1 2 3 4

      • 1
        BMP  commented on Jan. 29, 2019, 10:30 p.m.

        Aren't the numbers separated by a line break?


        • 1
          geese  commented on Jan. 30, 2019, 12:14 a.m.

          The numbers make 1 sequence out of 4 total sequences.


  • 7
    avid  commented on Jan. 2, 2019, 6:27 p.m.

    This problem is cheese.


  • 0
    Piercenia  commented on Jan. 1, 2019, 12:51 a.m.

    My problem is "java.lang.OutOfMemoryError" and I can't figure out what's causing it; does line breaking have anything to do with this? (I have no clue what a line break is.)


    • 1
      kingW3  commented on Jan. 2, 2019, 12:57 p.m. edited

      .


    • 1
      magicalsoup  commented on Jan. 2, 2019, 11:15 a.m.

      most likely you are storing numbers in an array, with 1000,000 numbers, that requires about 1000,000 * 8 bytes, or about 8 megabytes, which is over the memory limit for this problem


  • -12
    arcsaber  commented on Aug. 25, 2016, 10:41 p.m.

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


    • 28
      r3mark  commented on Aug. 27, 2016, 11:17 a.m.

      BeepBeep! I'm a bot. Your comment seems sad to us, cheer up! Have a kitten P.S. This bot is powered by A.I. sentiment analysis


  • 2
    bruce  commented on April 16, 2016, 9:49 a.m.

    The value range should be from -2^{63} to 2^{63}-1 (long long range), right?


  • -1
    k_53P  commented on April 1, 2016, 9:08 a.m.

    Use a line break as a separator, not a space. The statement has been updated.