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 1019. Line Painting

How do you use segment trees to solve this in O(n*logn)
Posted by Deliverance 27 Mar 2006 18:14
I usually use segment trees or interval trees to update on a given intrerval say [ 1 , N ] and need maximum 2^K memory where 2^K>2*N-1, but in this case the interval in which we would want updates is too big 10^9 and that's a definetely NO for a segment tree with 2^30 nodes!!!
So can you please give me some hints on how to solve this in O(n*logn) with or without using a segment tree, please :)
Re: How do you use segment trees to solve this in O(n*logn)
Posted by Falin.Lov 31 Mar 2006 12:41
First do the separate ,then the memoty will be just 2*2*N.
Remember there are just 10000 numbers.
sorry for my poor English.
Re: How do you use segment trees to solve this in O(n*logn)
Posted by TheBeet 16 Aug 2006 09:30
I got AC in 0.015s
My solution is O(n*logn)
I just use a Heap.