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 2109. Tourism on Mars

AllWhoWantsToSolveThisProblem
Posted by Felix_Mate 20 Nov 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
Posted by Jane Soboleva (SumNU) 21 Nov 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.