ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1521. Военные учения 2

I use interval tree (n * log n) and only 0.281c. How to improve?
Послано Ont 23 янв 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?
Послано Peter Ivanov 25 янв 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?
Послано Peter Ivanov 25 янв 2007 04:47
..but I doubt there are many O(n^3/2) solutions better then the O(nlogn)
No subject
Послано @ntiFreeze 26 фев 2007 22:51
can anybody give me link about Interval Tree?
Re: No subject
Послано svr 26 фев 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
Послано svr 16 сен 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
Послано Giorgi Saghinadze (Tbilisi SU) 18 сен 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
Послано svr 18 сен 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.