List Minimum (Easy)

View as PDF

Submit solution

Points: 3 (partial)
Time limit: 0.5s
C# 0.75s
Haskell 1.0s
Java 0.6s
Python 1.0s
Memory limit: 3M
C# 28M
Haskell 6M
Python 12M

Problem type
Brute Force Practice 1 — Easy Version

Given a permutation of the integers 1, 2, \dots, 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, \dots, N.

Output Specification

The sorted permutation on a single line.

Sample Input

2 1 3

Sample Output

1 2 3


  • -4
    phoenix728  commented on Oct. 25, 2022, 4:57 a.m.

    Not easy for Python:(

    • 0
      gj504772  commented on Nov. 21, 2022, 3:12 a.m. edit 5

      It's actually pretty easy if you read the question carefully, you can solve it with 1 lines of code in python

  • 1
    John  commented on Oct. 6, 2022, 7:02 p.m.

    Why would you need to reread the problem statement? It's just a matter of not exceeding the memory limit, which was definitely a challenge on C++

  • 1
    iam  commented on Jan. 28, 2022, 9:24 p.m.

    I'm still getting MLE on 19-25 in Python, and I'm not sure what the issue is.

    I've figured out that storing the second input guarantees MLE, so I'm sending that to the bitbucket, and I'm using a generator for the output.

    if it counts the base RAM for the script (8MB in Python if I recall correctly), that gives you not much space to work with

    Seems like numpy would be the solution here, but numpy isn't available in the test platform...

  • -1
    Code  commented on Sept. 19, 2021, 1:46 a.m.

    Perhaps searching up what a permutation is might help some people struggling with a TLE error.

  • 0
    Formoon28  commented on July 25, 2021, 2:32 a.m. edit 2

    I'm doing this problem in java and I can pass the first 18 test cases, but the rest all have java.lang.OutOfMemoryError and one has a TLE error. Does anyone have any tips to this problem? Also, I'm not entirely sure what everyone means by "read the question very carefully.", I think I'm overlooking something.

    Edit: Figured it out, the info is sneaky lol

  • 0
    YoInferno  commented on July 11, 2021, 2:13 a.m.

    If you were as unlucky as me, make sure you apply your ideas to your best code currently. I applied the MLE fix in one of my attempts however my code wouldn't have worked regardless if it had an MLE error or not.

  • 3
    AverageGamer8  commented on July 10, 2021, 2:44 p.m.

    if you're still having memory issues even after figuring it out, remember that not everything is important

  • 3
    dchoo333  commented on July 10, 2021, 1:58 a.m.

    Bro this is a troll :) When you actually read it can be good sometimes.

    • 2
      thomas_li  commented on July 12, 2021, 2:26 a.m.

      No, this is this.

      • 8
        doruuu  commented on July 13, 2021, 12:04 a.m.

        No, the keyword this is a prvalue expression whose value is the address of the implicit object parameter (object on which the non-static member function is being called).

        • 5
          EpicChadGamer  commented on July 13, 2021, 12:35 a.m.

          No, value is value.

      • 2
        dxke02  commented on July 12, 2021, 2:35 a.m.


  • -1
    dchoo333  commented on July 9, 2021, 11:42 a.m.

    I'm getting AC for the first 7 test cases, but MLE for the rest. Could anyone explain why this is happening? Thanks.

    • 6
      Badmode  commented on July 9, 2021, 3:49 p.m. edit 2

      Storing 1 million numbers will go past the memory limit in any language. You don't have to store the inputs to solve this problem. If you store the input, you will get MLE!

  • 2
    ayay9  commented on May 27, 2021, 3:06 a.m. edit 2

    Everyone: read the question very carefully

    me: still WAs everything

    edit nvm solved it after 900000 hours

  • -12
    medmoj  commented on Feb. 27, 2021, 7:34 p.m. edit 2

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

  • 0
    ryanawad  commented on Feb. 22, 2021, 3:44 a.m. edited

    Wow. I must say, I really enjoyed this problem. I hate my lack of common sense.

    • 0
      stanleyjzheng  commented on Dec. 19, 2021, 2:26 a.m.

      Wow. I Wholeheartedly Agree.

  • 0
    OneYearOld  commented on Dec. 26, 2020, 10:13 p.m.

    If you can't find the solution in the problem statement via rereading, looking at your output will help.

  • 16
    Ian456s  commented on Aug. 30, 2020, 8:43 p.m.

    this question's a straight up troll lmao

  • 1
    hjanday  commented on May 10, 2020, 5:22 p.m.

    I just solved it, and everyone is correct, you need to nit pick certain bits of information and think of a solution. Phew, that took me awhile, I enjoyed this problem! Thumbs up to the creator.

  • 3
    DorshReal  commented on April 21, 2020, 6:06 p.m.

    This question took me longer then it should have.

  • 5
    Redstone_ray  commented on April 5, 2020, 10:58 p.m.

    Tip: you don't need to store inputs you don't need to save memory

  • 8
    alihu264  commented on March 13, 2020, 8:20 p.m.

    Lol this was actually way easier than I thought

    Learning to read really does come in handy sometimes

  • 13
    Cools  commented on July 7, 2019, 8:28 p.m.

    Easier than it looks

  • 3
    Zanger  commented on March 31, 2019, 3:34 a.m.

    Omg the way this question phrases the goal is just down right dirty. gawd XD

  • 0
    benito255  commented on March 6, 2019, 11:24 a.m.

    OMG, finally got there with python - and learned something new which I guess is the point :)

    • -4
      Julien  commented on Nov. 30, 2019, 11:50 p.m.

      How did you get over the memory error?

      • 5
        AlanL  commented on Dec. 1, 2019, 1:52 a.m.

        As stated below, read the question very carefully.

  • -5
    lele  commented on Jan. 24, 2019, 1:59 a.m.

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

    • 0
      magicalsoup  commented on Jan. 24, 2019, 2:05 a.m. edited

      make some of your own test cases, read the question carefully, be sure not to miss out on any important properties of this question, and the reason you are getting WA is simply because your program is incorrect

      • -6
        lele  commented on Jan. 26, 2019, 11:36 p.m.

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

  • 6
    richardyou777  commented on Dec. 23, 2018, 9:13 p.m.

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

    • -10
      lele  commented on Jan. 24, 2019, 2:17 a.m.

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

  • -5
    Arihan10  commented on Dec. 18, 2018, 6:09 p.m.

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

    • -1
      magicalsoup  commented on Dec. 18, 2018, 11:30 p.m.

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

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

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

  • 31
    Plasmatic  commented on Oct. 26, 2018, 2:57 a.m.

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