Skip to content

Commit

Permalink
🔀 make fork up-to-date
Browse files Browse the repository at this point in the history
  • Loading branch information
StudyingFather authored Oct 19, 2019
2 parents 30202c3 + 474f023 commit 2e2f7a6
Show file tree
Hide file tree
Showing 147 changed files with 3,589 additions and 1,306 deletions.
28 changes: 28 additions & 0 deletions docs/_static/css/extra.css
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,31 @@ h5 {
font-size: 1.6rem !important;
}
*/

/* https://www.mdui.org/docs/shadow */

.mdui-shadow-0{-webkit-box-shadow:none!important;box-shadow:none!important}
.mdui-shadow-1{-webkit-box-shadow:0 2px 1px -1px rgba(0,0,0,.2),0 1px 1px 0 rgba(0,0,0,.14),0 1px 3px 0 rgba(0,0,0,.12)!important;box-shadow:0 2px 1px -1px rgba(0,0,0,.2),0 1px 1px 0 rgba(0,0,0,.14),0 1px 3px 0 rgba(0,0,0,.12)!important}
.mdui-shadow-2{-webkit-box-shadow:0 3px 1px -2px rgba(0,0,0,.2),0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12)!important;box-shadow:0 3px 1px -2px rgba(0,0,0,.2),0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12)!important}
.mdui-shadow-3{-webkit-box-shadow:0 3px 3px -2px rgba(0,0,0,.2),0 3px 4px 0 rgba(0,0,0,.14),0 1px 8px 0 rgba(0,0,0,.12)!important;box-shadow:0 3px 3px -2px rgba(0,0,0,.2),0 3px 4px 0 rgba(0,0,0,.14),0 1px 8px 0 rgba(0,0,0,.12)!important}
.mdui-shadow-4{-webkit-box-shadow:0 2px 4px -1px rgba(0,0,0,.2),0 4px 5px 0 rgba(0,0,0,.14),0 1px 10px 0 rgba(0,0,0,.12)!important;box-shadow:0 2px 4px -1px rgba(0,0,0,.2),0 4px 5px 0 rgba(0,0,0,.14),0 1px 10px 0 rgba(0,0,0,.12)!important}
.mdui-shadow-5{-webkit-box-shadow:0 3px 5px -1px rgba(0,0,0,.2),0 5px 8px 0 rgba(0,0,0,.14),0 1px 14px 0 rgba(0,0,0,.12)!important;box-shadow:0 3px 5px -1px rgba(0,0,0,.2),0 5px 8px 0 rgba(0,0,0,.14),0 1px 14px 0 rgba(0,0,0,.12)!important}
.mdui-shadow-6{-webkit-box-shadow:0 3px 5px -1px rgba(0,0,0,.2),0 6px 10px 0 rgba(0,0,0,.14),0 1px 18px 0 rgba(0,0,0,.12)!important;box-shadow:0 3px 5px -1px rgba(0,0,0,.2),0 6px 10px 0 rgba(0,0,0,.14),0 1px 18px 0 rgba(0,0,0,.12)!important}
.mdui-shadow-7{-webkit-box-shadow:0 4px 5px -2px rgba(0,0,0,.2),0 7px 10px 1px rgba(0,0,0,.14),0 2px 16px 1px rgba(0,0,0,.12)!important;box-shadow:0 4px 5px -2px rgba(0,0,0,.2),0 7px 10px 1px rgba(0,0,0,.14),0 2px 16px 1px rgba(0,0,0,.12)!important}
.mdui-shadow-8{-webkit-box-shadow:0 5px 5px -3px rgba(0,0,0,.2),0 8px 10px 1px rgba(0,0,0,.14),0 3px 14px 2px rgba(0,0,0,.12)!important;box-shadow:0 5px 5px -3px rgba(0,0,0,.2),0 8px 10px 1px rgba(0,0,0,.14),0 3px 14px 2px rgba(0,0,0,.12)!important}
.mdui-shadow-9{-webkit-box-shadow:0 5px 6px -3px rgba(0,0,0,.2),0 9px 12px 1px rgba(0,0,0,.14),0 3px 16px 2px rgba(0,0,0,.12)!important;box-shadow:0 5px 6px -3px rgba(0,0,0,.2),0 9px 12px 1px rgba(0,0,0,.14),0 3px 16px 2px rgba(0,0,0,.12)!important}
.mdui-shadow-10{-webkit-box-shadow:0 6px 6px -3px rgba(0,0,0,.2),0 10px 14px 1px rgba(0,0,0,.14),0 4px 18px 3px rgba(0,0,0,.12)!important;box-shadow:0 6px 6px -3px rgba(0,0,0,.2),0 10px 14px 1px rgba(0,0,0,.14),0 4px 18px 3px rgba(0,0,0,.12)!important}
.mdui-shadow-11{-webkit-box-shadow:0 6px 7px -4px rgba(0,0,0,.2),0 11px 15px 1px rgba(0,0,0,.14),0 4px 20px 3px rgba(0,0,0,.12)!important;box-shadow:0 6px 7px -4px rgba(0,0,0,.2),0 11px 15px 1px rgba(0,0,0,.14),0 4px 20px 3px rgba(0,0,0,.12)!important}
.mdui-shadow-12{-webkit-box-shadow:0 7px 8px -4px rgba(0,0,0,.2),0 12px 17px 2px rgba(0,0,0,.14),0 5px 22px 4px rgba(0,0,0,.12)!important;box-shadow:0 7px 8px -4px rgba(0,0,0,.2),0 12px 17px 2px rgba(0,0,0,.14),0 5px 22px 4px rgba(0,0,0,.12)!important}
.mdui-shadow-13{-webkit-box-shadow:0 7px 8px -4px rgba(0,0,0,.2),0 13px 19px 2px rgba(0,0,0,.14),0 5px 24px 4px rgba(0,0,0,.12)!important;box-shadow:0 7px 8px -4px rgba(0,0,0,.2),0 13px 19px 2px rgba(0,0,0,.14),0 5px 24px 4px rgba(0,0,0,.12)!important}
.mdui-shadow-14{-webkit-box-shadow:0 7px 9px -4px rgba(0,0,0,.2),0 14px 21px 2px rgba(0,0,0,.14),0 5px 26px 4px rgba(0,0,0,.12)!important;box-shadow:0 7px 9px -4px rgba(0,0,0,.2),0 14px 21px 2px rgba(0,0,0,.14),0 5px 26px 4px rgba(0,0,0,.12)!important}
.mdui-shadow-15{-webkit-box-shadow:0 8px 9px -5px rgba(0,0,0,.2),0 15px 22px 2px rgba(0,0,0,.14),0 6px 28px 5px rgba(0,0,0,.12)!important;box-shadow:0 8px 9px -5px rgba(0,0,0,.2),0 15px 22px 2px rgba(0,0,0,.14),0 6px 28px 5px rgba(0,0,0,.12)!important}
.mdui-shadow-16{-webkit-box-shadow:0 8px 10px -5px rgba(0,0,0,.2),0 16px 24px 2px rgba(0,0,0,.14),0 6px 30px 5px rgba(0,0,0,.12)!important;box-shadow:0 8px 10px -5px rgba(0,0,0,.2),0 16px 24px 2px rgba(0,0,0,.14),0 6px 30px 5px rgba(0,0,0,.12)!important}
.mdui-shadow-17{-webkit-box-shadow:0 8px 11px -5px rgba(0,0,0,.2),0 17px 26px 2px rgba(0,0,0,.14),0 6px 32px 5px rgba(0,0,0,.12)!important;box-shadow:0 8px 11px -5px rgba(0,0,0,.2),0 17px 26px 2px rgba(0,0,0,.14),0 6px 32px 5px rgba(0,0,0,.12)!important}
.mdui-shadow-18{-webkit-box-shadow:0 9px 11px -5px rgba(0,0,0,.2),0 18px 28px 2px rgba(0,0,0,.14),0 7px 34px 6px rgba(0,0,0,.12)!important;box-shadow:0 9px 11px -5px rgba(0,0,0,.2),0 18px 28px 2px rgba(0,0,0,.14),0 7px 34px 6px rgba(0,0,0,.12)!important}
.mdui-shadow-19{-webkit-box-shadow:0 9px 12px -6px rgba(0,0,0,.2),0 19px 29px 2px rgba(0,0,0,.14),0 7px 36px 6px rgba(0,0,0,.12)!important;box-shadow:0 9px 12px -6px rgba(0,0,0,.2),0 19px 29px 2px rgba(0,0,0,.14),0 7px 36px 6px rgba(0,0,0,.12)!important}
.mdui-shadow-20{-webkit-box-shadow:0 10px 13px -6px rgba(0,0,0,.2),0 20px 31px 3px rgba(0,0,0,.14),0 8px 38px 7px rgba(0,0,0,.12)!important;box-shadow:0 10px 13px -6px rgba(0,0,0,.2),0 20px 31px 3px rgba(0,0,0,.14),0 8px 38px 7px rgba(0,0,0,.12)!important}
.mdui-shadow-21{-webkit-box-shadow:0 10px 13px -6px rgba(0,0,0,.2),0 21px 33px 3px rgba(0,0,0,.14),0 8px 40px 7px rgba(0,0,0,.12)!important;box-shadow:0 10px 13px -6px rgba(0,0,0,.2),0 21px 33px 3px rgba(0,0,0,.14),0 8px 40px 7px rgba(0,0,0,.12)!important}
.mdui-shadow-22{-webkit-box-shadow:0 10px 14px -6px rgba(0,0,0,.2),0 22px 35px 3px rgba(0,0,0,.14),0 8px 42px 7px rgba(0,0,0,.12)!important;box-shadow:0 10px 14px -6px rgba(0,0,0,.2),0 22px 35px 3px rgba(0,0,0,.14),0 8px 42px 7px rgba(0,0,0,.12)!important}
.mdui-shadow-23{-webkit-box-shadow:0 11px 14px -7px rgba(0,0,0,.2),0 23px 36px 3px rgba(0,0,0,.14),0 9px 44px 8px rgba(0,0,0,.12)!important;box-shadow:0 11px 14px -7px rgba(0,0,0,.2),0 23px 36px 3px rgba(0,0,0,.14),0 9px 44px 8px rgba(0,0,0,.12)!important}
.mdui-shadow-24{-webkit-box-shadow:0 11px 15px -7px rgba(0,0,0,.2),0 24px 38px 3px rgba(0,0,0,.14),0 9px 46px 8px rgba(0,0,0,.12)!important;box-shadow:0 11px 15px -7px rgba(0,0,0,.2),0 24px 38px 3px rgba(0,0,0,.14),0 9px 46px 8px rgba(0,0,0,.12)!important}
2 changes: 1 addition & 1 deletion docs/basic/construction.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ $$

#### Problem

[BZOJ4971:\[Lydsy1708 月赛\]记忆中的背包](https://www.lydsy.com/JudgeOnline/problem.php?id=4971)
[Lydsy1708 月赛记忆中的背包](https://www.lydsy.com/JudgeOnline/problem.php?id=4971)

#### Solution

Expand Down
5 changes: 2 additions & 3 deletions docs/basic/greedy.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

用排序法常见的情况是输入一个包含几个(一般一到两个)权值的数组,通过排序然后遍历模拟计算的方法求出最优值。

有些题的排序方法非常显然,如 [Luogu P1209\[USACO1.3\]修理牛棚 Barn Repair](https://www.luogu.org/problemnew/show/P1209) 就是将输入数组差分后排序模拟求值。
有些题的排序方法非常显然,如 [USACO1.3修理牛棚 Barn Repair](https://www.luogu.org/problemnew/show/P1209) 就是将输入数组差分后排序模拟求值。

然而有些时候很难直接一下子看出排序方法,比如 [NOIP 2012 国王游戏](https://vijos.org/p/1779) 就很容易凭直觉而错误地以 $a$ 或 $b$ 为关键字排序,过样例之后提交就发现 WA 了 QAQ。一个常见办法就是尝试交换数组相邻的两个元素来 **推导** 出正确的排序方法。我们假设这题输入的俩个数用一个结构体来保存

Expand Down Expand Up @@ -86,12 +86,11 @@ struct uv {
};
```
~~看上去是不是很简单呢(这题高精度卡常……)~~
如果看懂了就可以尝试下一道类似的题: [Luogu P2123 皇后游戏](https://www.luogu.org/problemnew/show/P2123)
## 后悔法
??? note " 例题[Luogu P2949\[USACO09OPEN\]工作调度 Work Scheduling](https://www.luogu.org/problemnew/show/P2949)"
??? note " 例题[USACO09OPEN工作调度 Work Scheduling](https://www.luogu.org/problemnew/show/P2949)"
贪心思想:
Expand Down
2 changes: 1 addition & 1 deletion docs/basic/prefix-sum.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ int main() {
- [洛谷 U53525 前缀和(例题)](https://www.luogu.org/problemnew/show/U53525)
- [洛谷 U69096 前缀和的逆](https://www.luogu.org/problemnew/show/U69096)
- [AT2412 最大の和](https://www.luogu.org/problemnew/show/AT2412)
- [洛谷 P3131\[USACO16JAN\]子共七 Subsequences Summing to Sevens](https://www.luogu.org/problemnew/show/P3131)
- [USACO16JAN子共七 Subsequences Summing to Sevens](https://www.luogu.org/problemnew/show/P3131)

### 参考

Expand Down
4 changes: 2 additions & 2 deletions docs/basic/simulate.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
模拟。顾名思义,就是用计算机来模拟题目中要求的操作,比如 NOIP 2014 的 [生活大爆炸版石头剪刀布](https://loj.ac/problem/2498) ,只需要按照题面的意思来写就可以了。
模拟。顾名思义,就是用计算机来模拟题目中要求的操作,比如 NOIP 2014 的 [生活大爆炸版石头剪刀布](http://uoj.ac/problem/15) ,只需要按照题面的意思来写就可以了。

当然,模拟并不总是很好写,参见经典题目 [魔兽世界](http://bailian.openjudge.cn/practice/3750/)[猪国杀](https://www.lydsy.com/JudgeOnline/problem.php?id=1972)
当然,模拟并不总是很好写,参见经典题目 [魔兽世界](http://bailian.openjudge.cn/practice/3750/)[猪国杀](https://loj.ac/problem/2885)

模拟题目通常具有码量大、操作多、思路繁复的特点。并且由于它码量大,会导致很难查错,如果在考试中写错是相当浪费时间的。

Expand Down
4 changes: 2 additions & 2 deletions docs/dp/interval.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

**求解** :对整个问题设最优值,枚举合并点,将问题分解为左右两个部分,最后合并两个部分的最优值得到原问题的最优值。

??? note " 例题[洛谷 P1880\[NOI1995\]石子合并](https://www.luogu.org/problemnew/show/P1880)"
??? note " 例题[NOI1995石子合并](https://loj.ac/problem/10147)"
题目大意:在一个环上有 $n$ 个数 $a_1,a_2,...,a_n$ ,进行 $n-1$ 次合并操作,每次操作将相邻的两堆合并成一堆,能获得新的一堆中的石子数量的和的得分。你需要最大化你的得分。

考虑不在环上,而在一条链上的情况。
Expand Down Expand Up @@ -50,4 +50,4 @@ for (len = 1; len <= n; len++)
[NOIP 2007 矩阵取数游戏](https://vijos.org/p/1378)
[洛谷 P4767\[IOI2000\]邮局](https://www.luogu.org/problemnew/show/P4767)
[IOI2000邮局](https://www.luogu.org/problemnew/show/P4767)
6 changes: 3 additions & 3 deletions docs/dp/number.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

数位 DP 问题往往都是这样的题型,给定一个闭区间 $[l,r]$ ,让你求这个区间中满足 **某种条件** 的数的总数。

??? note " 例题[SCOI2009 windy 数](https://www.lydsy.com/JudgeOnline/problem.php?id=1026)"
??? note " 例题[SCOI2009 windy 数](https://loj.ac/problem/10165)"
题目大意:给定一个区间 $[l,r]$ ,求其中满足条件 **不含前导 $0$ 且相邻两个数字相差至少为 $2$ ** 的数字个数。

首先我们将问题转化成更加简单的形式。设 $ans_i$ 表示在区间 $[1,i]$ 中满足条件的数的数量,那么所求的答案就是 $ans_r-ans_{l-1}$ 。
Expand Down Expand Up @@ -54,9 +54,9 @@ int solve(int x) {
[BZOJ 3679 数字之积](https://www.lydsy.com/JudgeOnline/problem.php?id=3679)
[ZJOI2010 count 数字计数](https://www.lydsy.com/JudgeOnline/problem.php?id=1833)
[ZJOI2010 count 数字计数](https://loj.ac/problem/10169)
[Ahoi2009 self 同类分布](https://www.lydsy.com/JudgeOnline/problem.php?id=1799)
[Ahoi2009 self 同类分布](https://www.luogu.org/problem/P4127)
[洛谷 P3413 SAC#1 - 萌数](https://www.luogu.org/problemnew/show/P3413)
Expand Down
4 changes: 2 additions & 2 deletions docs/dp/opt/monotonous-queue-stack.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ author: TrisolarisHD, hsfzLZH1, Ir1d, greyqz, Anguei, billchenchina, Chrogeek, C

[「Luogu P1886」滑动窗口](https://www.luogu.org/problemnew/show/P1886)

[「NOI2005」瑰丽华尔兹](https://www.lydsy.com/JudgeOnline/problem.php?id=1499)
[「NOI2005」瑰丽华尔兹](https://www.luogu.org/problem/P2254)

[「SCOI2010」股票交易](https://www.lydsy.com/JudgeOnline/problem.php?id=1855)
[「SCOI2010」股票交易](https://loj.ac/problem/10183)
2 changes: 1 addition & 1 deletion docs/dp/opt/quadrangle.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ $$

回顾例题 1 中的 $w(l, r) = -a_l - \sqrt{r-l} + a_r$ ,由性质 2 可知 $-a_l+a_r$ 满足四边形不等式,而 $r-l$ 满足四边形恒等式和区间包含单调性。再根据 $-\sqrt{x}$ 的凸性以及性质 4 可知 $-\sqrt{r-l}$ 也满足四边形不等式,最终利用性质 1,即可得出 $w(l, r)$ 满足四边形不等式性质了。

### 例题 2. [BZOJ1010」「HNOI2008」玩具装箱 toy](https://www.lydsy.com/JudgeOnline/problem.php?id=1010)
### 例题 2. [「HNOI2008」玩具装箱 toy](https://loj.ac/problem/10188)

题目大意:有 $n$ 个玩具需要装箱,要求每个箱子中的玩具编号必须是连续的。每个玩具有一个长度 $C_i$ ,如果一个箱子中有多个玩具,那么每两个玩具之间要加入一个单位长度的分隔物。形式化地说,如果将编号在 $[l,r]$ 间的玩具装在一个箱子里,那么这个箱子的长度为 $r-l+\sum_{k=l}^r C_k$ 。现在需要制定一个装箱方案,使得所有容器的长度与 $K$ 差值的平方之和最小。

Expand Down
18 changes: 9 additions & 9 deletions docs/dp/opt/slope.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ author: TrisolarisHD, hsfzLZH1, abc1763613206, greyqz, Ir1d, billchenchina, Chro

## 例题选讲

??? note " 例题[「HNOI2008」玩具装箱 TOY](https://www.lydsy.com/JudgeOnline/problem.php?id=1010)"
??? note " 例题[「HNOI2008」玩具装箱 TOY](https://loj.ac/problem/10188)"
令 $f_i$ 表示前 $i$ 个物品,随意分组装在任意多个容器里所能得到的最小费用。

写出 **状态转移方程** : $f_i=\min\{f_j+(pre_i-pre_j+i-j-1-L)^2\}$ ,其中 $pre_i$ 表示前 $i$ 个数的前缀和。
Expand All @@ -23,20 +23,20 @@ author: TrisolarisHD, hsfzLZH1, abc1763613206, greyqz, Ir1d, billchenchina, Chro

## 习题

[「SDOI2016」征途](https://www.lydsy.com/JudgeOnline/problem.php?id=4518)
[「SDOI2016」征途](https://loj.ac/problem/2035)

[「ZJOI2007」仓库建设](https://www.lydsy.com/JudgeOnline/problem.php?id=1096)
[「ZJOI2007」仓库建设](https://loj.ac/problem/10189)

[「APIO2010」特别行动队](https://www.lydsy.com/JudgeOnline/problem.php?id=1911)
[「APIO2010」特别行动队](https://loj.ac/problem/10190)

[BZOJ 4709」「JSOI2011」柠檬](https://www.lydsy.com/JudgeOnline/problem.php?id=4709)
[「JSOI2011」柠檬](https://www.luogu.org/problem/P5504)

[「Codeforces 311B」Cats Transport](http://codeforces.com/problemset/problem/311/B)

[「NOI2007」货币兑换](https://www.lydsy.com/JudgeOnline/problem.php?id=1492)
[「NOI2007」货币兑换](https://loj.ac/problem/2353)

[「NOI2019」回家路线](https://www.luogu.org/problemnew/show/P5468)
[「NOI2019」回家路线](https://loj.ac/problem/3156)

[「NOI2016」国王饮水记](https://www.luogu.org/problemnew/show/P1721)
[「NOI2016」国王饮水记](http://uoj.ac/problem/223)

[「NOI2014」购票](https://www.luogu.org/problemnew/show/P2305)
[「NOI2014」购票](http://uoj.ac/problem/7)
8 changes: 4 additions & 4 deletions docs/dp/state.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@

## 几道练习题

[NOI2001 炮兵阵地](https://www.luogu.org/problemnew/show/P2704)
[NOI2001 炮兵阵地](https://loj.ac/problem/10173)

[\[USACO06NOV\]玉米田 Corn Fields](https://www.luogu.org/problemnew/show/P1879)
[USACO06NOV玉米田 Corn Fields](https://www.luogu.org/problemnew/show/P1879)

[AHOI2009 中国象棋](https://www.lydsy.com/JudgeOnline/problem.php?id=1801)
[AHOI2009 中国象棋](https://www.luogu.org/problem/P2051)

[九省联考 2018 一双木棋](https://www.luogu.org/problemnew/show/P4363)
[九省联考 2018 一双木棋](https://loj.ac/problem/2471)
2 changes: 1 addition & 1 deletion docs/ds/balanced-in-seg.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ author: Dev-jqe, HeRaNO

## 经典例题

[二逼平衡树](https://www.lydsy.com/JudgeOnline/problem.php?id=3196) 外层线段树,内层平衡树。
[二逼平衡树](https://loj.ac/problem/106) 外层线段树,内层平衡树。

## 示例代码

Expand Down
4 changes: 2 additions & 2 deletions docs/ds/bit.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ int getsum(int x) { // a[1]……a[x]的和
}
```
## 区间加区间求和
## 区间加 & 区间求和
若维护序列 $a$ 的差分数组 $b$ ,此时我们对 $a$ 的一个前缀 $r$ 求和,即 $\sum_{i=1}^{r} a_i$ ,由差分数组定义得 $a_i=\sum_{j=1}^i b_j$
Expand Down Expand Up @@ -132,7 +132,7 @@ void add1(int l, int r, int v) {
}
long long getsum1(int l, int r) {
return (r + 1ll) * (getsum(t1, r) - getsum(t1, l - 1)) -
return (r + 1ll) * getsum(t1, r) - 1ll * l * getsum(t1, l - 1) -
(getsum(t2, r) - getsum(t2, l - 1));
}
```
Expand Down
4 changes: 2 additions & 2 deletions docs/ds/block-array.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,6 @@ int Answer(int l, int r, int c) {
1. [单点修改,区间查询](https://loj.ac/problem/130)
2. [区间修改,区间查询](https://loj.ac/problem/132)
3. [【模板】线段树 2](https://www.luogu.org/problemnew/show/P3373)
4. [\[Ynoi2019 模拟赛\]Yuno loves sqrt technology III](https://www.luogu.org/problemnew/show/P5048)
5. [\[Violet\]蒲公英](https://www.luogu.org/problemnew/show/P4168)
4. [Ynoi2019 模拟赛Yuno loves sqrt technology III](https://www.luogu.org/problemnew/show/P5048)
5. [Violet蒲公英](https://www.luogu.org/problemnew/show/P4168)
6. [作诗](https://www.luogu.org/problemnew/show/P4135)
12 changes: 5 additions & 7 deletions docs/ds/dsu.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ void makeSet(int size) {
## 查找
!!! 举个例子
几个家族进行宴会,但是家族普遍长寿,所以人数众多。由于长时间的分离以及年龄的增长,这些人逐渐忘掉了自己的亲人,只记得自己的爸爸是谁了,而最长者(称为「祖先」)的父亲已经去世,他只知道自己是祖先。为了确定自己是哪个家族,他们想出了一个办法,只要问自己的爸爸是不是祖先,一层一层的向上问,直到问到祖先。如果要判断两人是否在同一家族,只要看两人的祖先是不是同一人就可以了。
通俗地讲一个故事:几个家族进行宴会,但是家族普遍长寿,所以人数众多。由于长时间的分离以及年龄的增长,这些人逐渐忘掉了自己的亲人,只记得自己的爸爸是谁了,而最长者(称为「祖先」)的父亲已经去世,他只知道自己是祖先。为了确定自己是哪个家族,他们想出了一个办法,只要问自己的爸爸是不是祖先,一层一层的向上问,直到问到祖先。如果要判断两人是否在同一家族,只要看两人的祖先是不是同一人就可以了。
在这样的思想下,并查集的查找算法诞生了。
Expand Down Expand Up @@ -55,7 +53,7 @@ int find(int x) {
}
```
不太懂的话我们就上两张图吧
上两张图:
![p1](./images/dsu1.png)
Expand Down Expand Up @@ -121,11 +119,11 @@ void unionSet(int x, int y) {
## 经典题目
[「NOI2015」程序自动分析](https://www.lydsy.com/JudgeOnline/problem.php?id=4195)
[「NOI2015」程序自动分析](http://uoj.ac/problem/127)
[「JSOI2008」星球大战](https://www.lydsy.com/JudgeOnline/problem.php?id=1015)
[「JSOI2008」星球大战](https://www.luogu.org/problem/P1197)
[「NOI2001」食物链](http://poj.org/problem?id=1182)
[「NOI2001」食物链](https://www.luogu.org/problem/P2024)
[「NOI2002」银河英雄传说](https://www.luogu.org/problemnew/show/P1196)
Expand Down
Loading

0 comments on commit 2e2f7a6

Please sign in to comment.