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 1521. War Games 2

I use interval tree (n * log n) and only 0.281c. How to improve?
Posted by Ont 23 Jan 2007 08:18
How alogorithms with n^3/2 may be faster?
Re: I use interval tree (n * log n) and only 0.281c. How to improve?
Posted by Peter Ivanov 25 Jan 2007 04:39
Probably with lower constants in the compexity calculation.
Re: I use interval tree (n * log n) and only 0.281c. How to improve?
Posted by Peter Ivanov 25 Jan 2007 04:47
..but I doubt there are many O(n^3/2) solutions better then the O(nlogn)
No subject
Posted by @ntiFreeze 26 Feb 2007 22:51
can anybody give me link about Interval Tree?
Re: No subject
Posted by svr 26 Feb 2007 23:14
I think that to solve we should have dynamic container
with operations
delete-  O(lgn)
take_k_th - O(lgn)
try write the program (5 rows) in these terms.
After this find anywhere such data type
for example on base of red-black trees.
If you will read interval trees it will take long time
because all typical tasks in this theory far away of 1521/

Edited by author 26.02.2007 23:14
Re: No subject
Posted by svr 16 Sep 2007 18:49
Now I has made realization of this plan
 according with Cormen's augmented red-black
tree sytucture for which an additional field : size  belongs to  each vertex of balanced tree.
But have only 0.821 AC. Interval tree automatically
balanced but how make it augmented with such field ?
In all cases I very glad because this balanced structure
rather helpful.
For example interesting problem 1424 needs another augmented red-black tree (also as in Cormen) when in grredy algotithm we check next interval may or may not to
include it in optimal set
of intervals formed to this moment.

Edited by author 16.09.2007 18:54

Edited by author 16.09.2007 18:55
Re: No subject
Posted by Giorgi Saghinadze (Tbilisi SU) 18 Sep 2007 18:48
Binary Search Tree is faster then red - black trees in this case. I solved it using BST in 0.281 sec. At first I constructed balanced BST with n numbers and then there is a simple algorithm to delete and find n - th element in the tree

Edited by author 18.09.2007 18:49
Re: No subject
Posted by svr 18 Sep 2007 19:55
Yes. Order 1,2,3,...N predescribed and we can use random tree. But this situation rather seldom and very often
we have dynamic data base.