mayankp's blog

By mayankp, history, 6 years ago, In English

I have heard that the following problem that came on the 2011 IOI had a solution with O(log n) queries rather than O(sqrt(n)) queries by using link-cut trees. What is that solution?

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it

By mayankp, history, 7 years ago, In English

The following POI problem: main.edu.pl/en/archive/oi/21/hot, which asks one to find the number of vertices of a tree equidistant from one vertex, has a fairly simple O(n^2) solution, which is sufficient to get full points. However, when looking at the solution, there appeared to be a O(n log n) solution that used what appeared to be centroid decomposition, though it was hard to tell, since the solution was in Polish and google translate doesn't do that good of a job. What is a solution to this problem in O(n log n) that uses centroid decomposition, and are there any other solutions that get O(n log n) or better?

Full text and comments »

  • Vote: I like it
  • +5
  • Vote: I do not like it

By mayankp, history, 7 years ago, In English

How does one make a link-cut tree support finding the maximum (or anything else of the sort) along the edges of a vertex to the root? All implementations I have seen only support finding aggregates of vertices along such paths, and I think that simply having each vertex store the value of the edge from it to its parent doesn't work well when one links vertices which changes the parents of a bunch of vertices.

Full text and comments »

  • Vote: I like it
  • +13
  • Vote: I do not like it