Блог пользователя Butskhrikidze

Автор Butskhrikidze, история, 5 лет назад, По-английски

given $$$n$$$ segments $$$[l_i, r_i]$$$ where $$$-10^9 \leq l, r \leq 10^9$$$. we are given $$$q$$$ query. each query characterized by one integer $$$x$$$. for each query we must determine how many segment involves $$$x$$$ and detect segments itself by its number. How to solve this problem?

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор Butskhrikidze, история, 6 лет назад, По-английски

see tutorial about stern-brocot's tree Tutorial. this is infinity binary tree which nodes are irreducible fractions. enumerate nodes of tree using BFS. it is given one number n and one fraction . Your task is to determine what fraction is written on the node LCA(n, ) where LCA is Lowest Common Ancestor of nodes n and . (in first case node is defined by its number and in second case node is defined by fraction). 0 < a, b < 109 and 0 < n < 1018.

what is efficient method for finding what fraction is written on the node by its fraction and vice versa?

see example of tree

Полный текст и комментарии »

  • Проголосовать: нравится
  • +2
  • Проголосовать: не нравится