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
feat(fractional_cascading.md): 增加分散层叠 #5589
base: master
Are you sure you want to change the base?
Conversation
fairytaleqwq
commented
May 9, 2024
- 我已认真阅读贡献指南 (contributing guidelines) 和社区公约 (code of conduct),并遵循了如何参与页及格式手册页的相应规范。
感谢你对 OI Wiki 的关注!记得检查是否遵守了格式规范,听说和项目风格统一的 Pull Request 会更容易被 Merge~ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint finished, ready for review :)
请一并修改 mkdocs.yml,并把你的页面添加的合适的位置 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
目前的感觉好像是,题解。
思考,感觉好像还是有点,不对劲
@@ -0,0 +1,414 @@ | |||
# 引入 | |||
|
|||
[P6466 分散层叠算法(Fractional Cascading)](https://www.luogu.com.cn/problem/P6466) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
xx算法 好像和 xx算法模板题 是两个概念
docs/misc/fractional_cascading.md
Outdated
#include <bits/stdc++.h> | ||
#define re register | ||
#define il inline | ||
#define rep(x, qwq, qaq) for (re int(x) = (qwq); (x) <= (qaq); ++(x)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
别整这些宏了 好好写代码
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的我现在改
docs/misc/fractional_cascading.md
Outdated
|
||
绝大部分解法都是 $\mathcal O(n\sqrt n\log n)$ 或 $\mathcal O(n\sqrt{n\log n})$ 的,但是其实使用分散层叠能优化为 $\mathcal O(n\sqrt{n\log\log n})$ 甚至 $\mathcal O(n\sqrt n)$。 | ||
|
||
## 传统的 $\mathcal O(n\sqrt{n\log n})$ 做法 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个是不是应该是三级标题
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
以及标题里面不推荐用数学公式。因为显示效果不太好
docs/misc/fractional_cascading.md
Outdated
|
||
推广(引自论文): | ||
|
||
> “如果我们建立分散层叠时选取的比例为 $\frac{1}{r}$(本题 $r=2$),那么 $x$ 在 $M_i$ 中二分查找的结果(即 $y$)指向的 $M_{i+1}$ 的位置和 $x$ 在 $M_{i+1}$ 中二分查找的正确结果的距离不会超过 $r$。因为 $r$ 是一个常数,所以可以在 $\mathcal O(1)$ 的时间复杂度内求出 $x$ 在 $M_{i+1}$ 中二分查找的正确结果。” |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 可以放到折叠框
- 大段引原文,感觉不如直接给个原文链接并引用
- 哪篇论文
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
哦对,我加一下来源
给链接是不是要让读者跳转一下,感觉不如直接拉过来
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
都是可以的。建议可以都做。链接,和你的翻译都加上
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已经用了 >
的话,是不是就不需要用 “” 了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint finished, ready for review :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint finished, ready for review :)
docs/misc/fractional_cascading.md
Outdated
|
||
## 参考文献 | ||
|
||
[蒋明润《浅谈利用分散层叠算法对经典分块问题的优化》](https://rusunoi.github.io/books/National-Team-Thesis/2020.pdf) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs/misc/fractional_cascading.md
Outdated
综上,取块长为 $\sqrt n$ 时复杂度最优,为 $\mathcal O(n\sqrt n)$。 | ||
|
||
```cpp | ||
#include <bits/stdc++.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
代码建议收纳到折叠框里面,可以参考一下其它页面的用法。搜索 ???
可以搜到
注意折叠框里面的每一行(包括空行)都需要有4格的缩进
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs/misc/fractional_cascading.md
Outdated
### 引理 1:$y$ 在 $l_1$ 中的后继一定是 $x$ 在 $l_1$ 中的后继。 | ||
|
||
> 证明:若 $y$ 在 $l_1$ 中出现过,$y$ 的后继就是 $y$,显然成立。若 $y$ 不在 $l_1$ 中,$y$ 在 $l_1$ 中的后继就是 $x$ 在 $l_1$ 中的后继。 | ||
|
||
不难发现本条对任意 $l_i(1\le i\le k)$ 均成立。 | ||
|
||
### 引理 2:$y$ 在 $M_2$ 中的后继与 $x$ 在 $M_2$ 的后继下标差不超过 $2$。 | ||
|
||
> 证明:因为我们从 $M_2$ 中每两个数就选取一个加入 $M_1$,所以 $x$ 在 $M_2$ 的后继 $p$ 和 $x$ 在 $M_2$ 的后继的后继 $q$ 必定有一个加入了 $M_1$。(在 $M_2$ 中 $\ge x$ 的数 $< 2$ 个的情况下显然成立)因此 $x\le y\le q$,最极端情况下 $y=q$,此时 $y$ 在 $M_2$ 中的后继就是 $q$ 的后继,与 $x$ 的后继下标差为 $2$。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不知道是不是我的问题。感觉这两条引理出现的有点莫名其妙,这里能想办法处理的更符合直觉一点吗
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint finished, ready for review :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint finished, ready for review :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint finished, ready for review :)
我感觉可以看看其他页面内容规划这页吧(包括格式和内容),把原理抽离出题目来讲,最后题目只当做一个例题应用。现在这个版本更像博客或者大号题解? |
好,我尽量修改 |
最近学校要期中考试比较忙,不能及时修改,抱歉/ll 考完一定来修! |