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

Обсуждение задачи 2109. Туризм на Марсе

AllWhoWantsToSolveThisProblem
Послано Felix_Mate 20 ноя 2016 23:25
I think many people can not solve this problem because they do not have enough knowledge.
You should know "Problem LCA" and "Segment Tree" that to solve the problem.
My algo is O(n*sqrt(n)+m*log(n)), but i can solve for O(n+m*log(n)) (LCA can be solved for O(1) with preprocess or sqrt(n) without preprocess).

P.S. What is the optimal asymptotic behavior?

Edited by author 20.11.2016 23:27

Edited by author 20.11.2016 23:27

Edited by author 20.11.2016 23:28
Re: AllWhoWantsToSolveThisProblem
Послано Jane Soboleva (SumNU) 21 ноя 2016 21:45
Well, there were quite a lot of LCA + segment tree problems by now, so by now people mostly should know what that is :)
As for me, i just took my solution to http://acm.timus.ru/problem.aspx?space=1&num=1471 and only had to modify it very slightly. Just, in there you had to operate with only minimums, and here you need to find a minimum in a certain range of your array of minimums, so there's that additional layer of minimums.