Miracle Sort

View as PDF

Submit solution

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

Author:
Problem type

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


  • 4
    herro  commented on March 18, 2021, 2:47 a.m.

    imagine if someone actually passed with bogosort...


  • 5
    Tomorrow  commented on July 15, 2020, 9: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.


  • 4
    OneYearOld  commented on July 8, 2020, 1:47 p.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.


  • 8
    Plasmatic  commented on Feb. 3, 2019, 3:19 a.m. edit 2

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


    • 0
      yaxollum  commented on Feb. 3, 2019, 3:36 a.m.

      what is the miracle?


      • 2
        Lost  commented on March 20, 2022, 12:31 p.m.

        the sort


  • 1
    yaxollum  commented on Feb. 1, 2019, 1:00 a.m.

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


    • 1
      Lost  commented on March 20, 2022, 1:19 a.m.

      the miracle one


    • 3
      felixzhang25  commented on Feb. 6, 2022, 10:27 p.m.

      all of them.


      • 2
        andy_zhu23  commented on Feb. 6, 2022, 10:30 p.m.

        At the same time


  • -5
    Arihan10  commented on Jan. 29, 2019, 9:15 p.m.

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


    • 18
      TimothyW553  commented on Jan. 29, 2019, 10:22 p.m.

      Try this and tell me what you get

      4
      1 2 3 4

      • 1
        omaewamoushindeiru  commented on Jan. 30, 2019, 3:30 a.m.

        Aren't the numbers separated by a line break?


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

          The numbers make 1 sequence out of 4 total sequences.


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

    This problem is cheese.


  • -1
    Piercenia  commented on Jan. 1, 2019, 5: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.)


    • 2
      magicalsoup  commented on Jan. 2, 2019, 4:15 p.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. 26, 2016, 2:41 a.m.

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


    • 41
      r3mark  commented on Aug. 27, 2016, 3:17 p.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