Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[内容有误] 珂朵莉树代码含义不明 #3981

Open
1 task
Jebearssica opened this issue May 28, 2022 · 5 comments
Open
1 task

[内容有误] 珂朵莉树代码含义不明 #3981

Jebearssica opened this issue May 28, 2022 · 5 comments
Labels
Content Bug / 页面内容有误 Something isn't working help wanted / 需要帮助 Extra attention is needed

Comments

@Jebearssica
Copy link
Contributor

Jebearssica commented May 28, 2022

请选择:

  • 我正在着手修复这个问题

我正在访问这个页面

http://oi-wiki.com/ds/odt/

我发现页面有这样的问题

  • 函数 split 中的变量 n 并未注明含义
  • 珂朵莉树的初始化没讲清楚, 如果 split 的值目前并不在树上会产生错误
@Jebearssica Jebearssica added Content Bug / 页面内容有误 Something isn't working help wanted / 需要帮助 Extra attention is needed labels May 28, 2022
@Jebearssica
Copy link
Contributor Author

Jebearssica commented May 28, 2022

要是给我改的话,我想把整个 split 前半部分改成下面这种情况,这样看起来只需要像线段树一样,在初始化时加一个超大区间,并将赋予该区间一个特殊值,就能避免产生对不在树上的区间进行 split 的问题:

auto split(int x)
{
    auto iter = odt.lower_bound(Node_t(x, 0, 0));
    if(iter != odt.end() && iter->left == x)
        return iter;
    --iter;
    ......
}

@NFLSCode
Copy link
Contributor

NFLSCode commented Jun 4, 2022

upper_bound

@Jebearssica
Copy link
Contributor Author

upper_bound

--upper_bound 是最后一个 lower_bound, 是不是这样就能把所有重复的右边界都包括进去

@Jebearssica
Copy link
Contributor Author

感觉主要思想并没有阐述很清楚,是因为竞赛里都会卡这个,所以没有学习的必要了吗。。。作为一个面向面试的学习者,遇到区间修改的时候写这个很明显比写树状数组或线段树要快很多的样子。。。

@Great-designer

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content Bug / 页面内容有误 Something isn't working help wanted / 需要帮助 Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants