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

How alogorithms with n^3/2 may be faster?
Probably with lower constants in the compexity calculation.
..but I doubt there are many O(n^3/2) solutions better then the O(nlogn)
@ntiFreeze No subject [4] // Problem 1521. War Games 2 26 Feb 2007 22:51
can anybody give me link about Interval Tree?
svr Re: No subject [3] // Problem 1521. War Games 2 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
svr Re: No subject [2] // Problem 1521. War Games 2 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
Giorgi Saghinadze (Tbilisi SU) Re: No subject [1] // Problem 1521. War Games 2 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
svr Re: No subject // Problem 1521. War Games 2 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.