ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1992. CVS

Memory limit exceeded
Posted by Nataraj 23 Mar 2014 18:03
I am writing my solution in Java and I constantly getting "Memory Limit Exceeded" error
on 10th test.

I used ArrayList<Integer> to store 'programs' and 'rollbacks'.
Then lately I changed it TIntArrayList, to store 'int' as a basic type,
but still it does not solve the problem.

I saw solutions in Java, that people used less than 10Mb of memory.
What am I doing wrong?

Edited by author 23.03.2014 18:03

Edited by author 23.03.2014 18:04
Re: Memory limit exceeded
Posted by Nataraj 23 Mar 2014 20:50
Fully rewrote the algorithm, to calculate the solution each time in runtime, without using memory for each clone, but then my solutions exceeds Time limitation on 9th test.
I also do not understand why we get a number 'm' - number of educational program.
How this number could help us to solve the problem?
Re: Memory limit exceeded
Posted by Nataraj 24 Mar 2014 14:52
Finally solved it. The main trick was to find a way to make clone operation without coping all the clone memory.