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
Authors:
Problem type
Brute Force Practice 1 — Easy Version
Given a permutation of the integers , output the permutation after it has been sorted.
Input Specification
The first line will contain the integer
.
The next line will contain integers, a permutation of the integers
.
Output Specification
The sorted permutation on a single line.
Sample Input
3
2 1 3
Sample Output
1 2 3
Comments
Not easy for Python:(
It's actually pretty easy if you read the question carefully, you can solve it with 1 lines of code in python
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++
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...
Perhaps searching up what a permutation is might help some people struggling with a TLE error.
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
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.
if you're still having memory issues even after figuring it out, remember that not everything is important
Bro this is a troll :) When you actually read it can be good sometimes.
No, this is this.
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).No, value is value.
O_O
I'm getting AC for the first 7 test cases, but MLE for the rest. Could anyone explain why this is happening? Thanks.
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!
Everyone: read the question very carefully
me: still WAs everything
edit nvm solved it after 900000 hours
:(
This comment is hidden due to too much negative feedback. Show it anyway.
Wow. I must say, I really enjoyed this problem. I hate my lack of common sense.
Wow. I Wholeheartedly Agree.
If you can't find the solution in the problem statement via rereading, looking at your output will help.
this question's a straight up troll lmao
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.
This question took me longer then it should have.
Tip: you don't need to store inputs you don't need to save memory
Lol this was actually way easier than I thought
Learning to read really does come in handy sometimes
Easier than it looks
Omg the way this question phrases the goal is just down right dirty. gawd XD
OMG, finally got there with python - and learned something new which I guess is the point :)
How did you get over the memory error?
As stated below, read the question very carefully.
This comment is hidden due to too much negative feedback. Show it anyway.
make some of your own test cases, read the question
, be sure not to miss out on any
important properties
of this question, and the reason you are gettingWA
is simply because your program is incorrectThis comment is hidden due to too much negative feedback. Show it anyway.
I thought List Minimum (Easy) would be easy, but no.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
That means you are using too much memory, read the question carefully
The biggest problem in this question is to fully understand the question
Tip for anyone that's having issues with this question: reread the problem statement.