List Minimum (Easy)

View as PDF

Submit solution

Points: 3 (partial)
Time limit: 0.5s
Java 1.0s
Python 2.0s
Memory limit: 3M
Java 3M
Python 12M

Problem type
Brute Force Practice 1 — Easy Version

Given a permutation of the integers 1, 2, \ldots, N, output the permutation after it has been sorted.

Input Specification

The first line will contain the integer N\ (1 \le N \le 10^6).

The next line will contain N integers, a permutation of the integers 1, 2, \ldots, N.

Output Specification

The sorted permutation on a single line.

Sample Input

2 1 3

Sample Output

1 2 3


  • 0
    sankeeth_ganeswaran  commented on Dec. 29, 2018, 10:47 a.m. edited

    Can someone tell me what's wrong with my java code? Thanks.

    • -1
      IanHu  commented on Dec. 29, 2018, 3:12 p.m. edit 2

      Read the question carefully. In fact don't need to store any value to an array.

    • 5
      ss__jonathan  commented on Dec. 29, 2018, 11:21 a.m. edited

      Regarding the question, it states that you are given a permutation of the integers 1 to N. This is the best hint I can give you: don't try to sort the integers or store it in an array. The memory limit for java is 3 MB.

      The point of this question is to read it very, very carefully. Good luck!

  • 1
    richardyou777  commented on Dec. 23, 2018, 4:13 p.m.

    I thought List Minimum (Easy) would be easy, but no.

  • 0
    Arihan10  commented on Dec. 18, 2018, 1:09 p.m.

    I keep on getting Memory Error.

    • 1
      amagicalsoup4  commented on Dec. 18, 2018, 6:30 p.m.

      That means you are using too much memory, read the question carefully

  • 1
    IanHu  commented on Nov. 15, 2018, 3:43 p.m.

    OMG it's so tricky lolllllll

  • 1
    y2536209406  commented on Nov. 4, 2018, 12:06 a.m.

    The biggest problem in this question is to fully understand the question

  • 13
    Plasmatic  commented on Oct. 25, 2018, 10:57 p.m.

    Tip for anyone that's having issues with this question: reread the problem statement.

  • -9
    loltrollkill  commented on Oct. 25, 2018, 5:12 p.m.

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

    • 19
      ss__jonathan  commented on Oct. 25, 2018, 11:34 p.m. edit 3

      Well, seems like I got here before CopyPastePolice.

      Hi loltrollkill, on behalf of the DMOJ committee, we'd like to remind you that copying code is not respected in this community. We ask that you refrain from copying submissions off of Github. Several of your submissions have been investigated, and those that are found to be copied will be deleted. The investigation will continue, and similarly, those that are copied will also be purged. You can message me on Slack if you would like to (appeal in some sort of fashion?)

    • 10
      gnarlydude231  commented on Oct. 25, 2018, 10:36 p.m.

      Can solve a 40 pointer and a 30 pointer but can't solve a 3 pointer, hmmmm...

      • 5
        TimothyW553  commented on Oct. 25, 2018, 10:53 p.m.

        Agreed, can we get CPP in here?

    • 4
      kingW3  commented on Oct. 25, 2018, 5:30 p.m. edit 2

      It's supposed to be done in constant memory. And time is also not a problem with the intended solution.