|
|
вернуться в форумAllWhoWantsToSolveThisProblem 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 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. |
|
|