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 1037. Memory Management

Tell Me Solution
Posted by lasha_kapo 10 May 2011 21:56
Tell Me Solution
Re: Tell Me Solution
Posted by AterLux 11 May 2011 13:10
Use queue.
Store top-time in each queue element
Before each operation check died elements and remove it from queue.
Put processed element into end of queue
To speed up searching of free element, you can store in some variable index of least element that can be empty. When you allocating next element, you increase it. When one elemenet if "dying" with index less than that stored value, you assign to that index of died element.
And so on and so on...