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 1090. In the Army Now

I use mergesort and I have TLE#3 Why?
Posted by dimozzz 31 Jan 2007 22:12
It's your memory allocation problem (+)
Posted by Vladimir Yakovlev (USU) 31 Jan 2007 23:13
You shouldn't allocate memory for auxiliary array every time in your recursive method. You allocate this array O(K*log(N)) times. Try to allocate it only one time.
Re: It's your memory allocation problem (+)
Posted by dimozzz 1 Feb 2007 01:31
Thank you very much. I have AC with Java too.