Codeforces и Polygon могут быть недоступны в период с 6 декабря, 22:00 (МСК) по 7 декабря, 00:00 (МСК) в связи с проведением технических работ. ×

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

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

Hi everyone
I know that in Li Chao Tree it is possible to add some line of the form (ax + b), in the tree and query for a maximum or minimum y-intercept in a specific point, x.
I want to know that Is it possible to query for a maximum y-intercept in a range of values,x ?
More specifically, is it possible to choose such a value x from the interval [l, r] such that x gives the maximum y-intercept with complexity less than or equal to O(sqrt(N)) where 1 <= l <= r <= N <= 106 ?.

Your any kind of information regarding the topic will be appreciated.
Thank you.

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

»
5 лет назад, # |
Rev. 4   Проголосовать: нравится +17 Проголосовать: не нравится

Think of LiChao as a replacement of CHT. Now consider how you would answer queries of this type if you used CHT instead. Well that actually isn't so hard.

The lower hull is clearly convex, hence we can notice that the answer to some query defined by [L, R], will be the maximum of:

  • query(L)

  • query(R)

Well now consider using LiChao tree. You can use the exact same queries and then your queries can be solved in 2 normal LiChao queries.

PS: This is correct because of convexity applied for L and R.

Convexity states that for any $$$\alpha \in [0, 1]$$$ and any two $$$x_1, x_2$$$, we have:

$$$\alpha * f(x_1) + (1 - \alpha) * f(x_2) \geq f(\alpha * x_1 + (1 - \alpha) * x_2)$$$

Therefore, if we apply it for L, R and f(x) = query(x), we can see that for every $$$x \in [L, R]$$$, $$$f(x) \leq \max(f(L), f(R))$$$.