Skip to content

Commit

Permalink
add links
Browse files Browse the repository at this point in the history
  • Loading branch information
EndlessCheng committed May 11, 2020
1 parent 6877445 commit c0aa2f7
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 10 deletions.
8 changes: 8 additions & 0 deletions copypasta/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@

[Pepcy's Templates for OI and ICPC](http://pepcy.cf/icpc-templates/)

### 洛谷日报

[2020 年洛谷日报索引](https://www.luogu.com.cn/discuss/show/179788)

[2019 年洛谷日报索引](https://www.luogu.com.cn/discuss/show/92685)

[2018 年洛谷日报索引](https://www.luogu.com.cn/discuss/show/48491)

## 算法竞赛训练中较难的部分

https://blog.csdn.net/skywalkert/article/details/48924861
Expand Down
1 change: 1 addition & 0 deletions copypasta/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,7 @@ func moAlgorithm() {
}

// TODO: 带修改的莫队
// https://www.luogu.com.cn/blog/deco/qian-tan-ji-chu-gen-hao-suan-fa-fen-kuai

// TODO: 树上莫队

Expand Down
4 changes: 4 additions & 0 deletions copypasta/dp.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ func dpCollections() {

/* 状压 DP
NOTE: 若问题无法划分成小问题,必须考虑各种可能的情况,则可能是 NP 完全问题
浅谈状压 DP https://www.luogu.com.cn/blog/yijan/zhuang-ya-dp
CF tag https://codeforces.ml/problemset?order=BY_RATING_ASC&tags=dp%2Cbitmasks
todo 汉密尔顿路径/回路 Hamiltonian path
*/
Expand Down Expand Up @@ -441,6 +442,7 @@ func dpCollections() {
/* 插头 DP / 轮廓线动态规划
《训练指南》6.1
https://oi-wiki.org/dp/plug/
https://www.luogu.com.cn/blog/efforts-will-pay-off/du-liu-dong-gui-cha-tou-dp
*/

/* 数位 DP
Expand Down Expand Up @@ -521,12 +523,14 @@ func dpCollections() {
// https://codeforces.ml/blog/entry/63823
// todo https://blog.csdn.net/weixin_43914593/article/details/105560357
// todo https://luckyglass.github.io/2019/19Dec21stArt1/
// 浅谈斜率优化 https://www.luogu.com.cn/blog/duyi/xie-lv-you-hua
// 一类单调问题的求解(宋新波) http://www.doc88.com/p-2953873379975.html
// 题目 https://qiita.com/drken/items/9b311d553aa434bb26e4#%E4%BE%8B%E9%A1%8C-4-4-4k-anonymous-sequence-poj-no3709

// 四边形不等式优化
// https://oi-wiki.org/dp/opt/quadrangle/
// todo https://blog.csdn.net/weixin_43914593/article/details/105150937
// 决策单调性优化讲解 https://www.luogu.com.cn/blog/83547/zong-dong-tai-gui-hua-di-ben-zhi-kan-si-bian-xing-fou-deng-shi-you-hua

/* 树形 DP
https://codeforces.ml/blog/entry/20935
Expand Down
15 changes: 15 additions & 0 deletions copypasta/fenwick_tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package copypasta
// 树状数组
// 效率是线段树的 3~10 倍(由数据决定)
// https://oi-wiki.org/ds/bit/
// todo 浅谈树状数组的优化及扩展 https://www.luogu.com.cn/blog/countercurrent-time/qian-tan-shu-zhuang-shuo-zu-you-hua
// todo 浅谈树状数组套权值树 https://www.luogu.com.cn/blog/bfqaq/qian-tan-shu-zhuang-shuo-zu-quan-zhi-shu
// https://algs4.cs.princeton.edu/code/edu/princeton/cs/algs4/FenwickTree.java.html
// 模板题 https://www.luogu.com.cn/problem/P3374
// 题目推荐 https://cp-algorithms.com/data_structures/fenwick.html#toc-tgt-12
Expand All @@ -22,6 +24,19 @@ func fenwickTree(n int) {
}
query := func(l, r int) int { return sum(r) - sum(l-1) } // [l,r]

// 常数优化
// 参考 https://www.luogu.com.cn/blog/countercurrent-time/qian-tan-shu-zhuang-shuo-zu-you-hua
query = func(l, r int) (s int) {
l--
for ; r > l; r &= r - 1 {
s += tree[r]
}
for ; l > r; l &= l - 1 {
s -= tree[l]
}
return
}

// 差分树状数组,可用于区间更新+单点查询
// 单点查询 query(i) = a[i] + sum(i)
// 模板题 https://www.luogu.com.cn/problem/P3368
Expand Down
8 changes: 6 additions & 2 deletions copypasta/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ import (
)

/*
视频资料:
Graph Theory Playlist https://www.youtube.com/playlist?list=PLDV1Zeh2NRsDGO4--qE8yH72HFL1Km93P
图论的小技巧以及扩展 https://www.luogu.com.cn/blog/chengni5673/tu-lun-di-xiao-ji-qiao-yi-ji-kuo-zhan
CF tag https://codeforces.ml/problemset?order=BY_RATING_ASC&tags=graphs
TIPS: 使用一个 fa 数组(初始化为 -1)记录搜索树中的节点的父节点,这样对每个节点都有一条到根的路径(根的 fa 为 -1)
NOTE: 独立集相关问题,可以从染色的角度考虑
NOTE: 度数大于 √M 的点不超过 2√M 个
*/
Expand Down Expand Up @@ -1438,6 +1437,7 @@ func (G *graph) solve2SAT(in io.Reader, n, m int) []bool {
}

// 基环树
// https://www.luogu.com.cn/blog/user52918/qian-tan-ji-huan-shu
func (*graph) treeWithCycle(n int, g [][]int) {
// EXTRA: 内向基环树找环
inDeg := make([]int, n) // 计算入度 ...
Expand Down Expand Up @@ -1475,6 +1475,9 @@ func (*graph) treeWithCycle(n int, g [][]int) {
}
}

// 圆方树
// todo https://www.luogu.com.cn/blog/PinkRabbit/Introduction-to-Round-Square-Tree

/* 网络流
上下界网络流 https://oi-wiki.org/graph/flow/bound/
https://algs4.cs.princeton.edu/code/edu/princeton/cs/algs4/FordFulkerson.java.html
Expand Down Expand Up @@ -1578,6 +1581,7 @@ func (*graph) maxFlowDinic(in io.Reader, n, m, st, end int) (maxFlow int) {

// 预流推进 HLPP 算法(High Level Preflow Push)
// todo https://oi-wiki.org/graph/flow/max-flow/#hlpp
// https://www.luogu.com.cn/blog/ONE-PIECE/jiu-ji-di-zui-tai-liu-suan-fa-isap-yu-hlpp
// 模板题 https://www.luogu.com.cn/problem/P4722

// 最小费用最大流
Expand Down
9 changes: 9 additions & 0 deletions copypasta/graph_tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ func (*tree) findCentroid(n int, g [][]int) (ans int) {
}

// 点分治
// todo 点分治略解 https://www.luogu.com.cn/blog/user9012/dian-fen-zhi-lve-xie
// 例:求树上距离不超过 upperDis 的点对数 http://poj.org/problem?id=1741
// TODO: 需要重新整理
func (*tree) numPairsWithDistanceLimit(in io.Reader, n int, upperDis int64) int64 {
Expand Down Expand Up @@ -479,6 +480,7 @@ func (*tree) lcaTarjan(n, root int, g [][]int, _qs [][2]int) []int {
// 操作为更新 v-w 路径上的点权或边权(初始为 0)
// 点权时 diff[lca] -= val
// 边权时 diff[lca] -= 2 * val(定义 diff 为点到父亲的差分值)
// https://www.luogu.com.cn/blog/RPdreamer/ci-fen-and-shu-shang-ci-fen
func (*tree) differenceOnTree(n, root int, g [][]int) {
diff := make([]int, n)
update := func(v, w int, val int) {
Expand Down Expand Up @@ -509,6 +511,8 @@ func (*tree) differenceOnTree(n, root int, g [][]int) {
// https://en.wikipedia.org/wiki/Heavy_path_decomposition
// https://oi-wiki.org/graph/hld/
// https://cp-algorithms.com/graph/hld.html
// dsu on tree学习笔记 https://www.luogu.com.cn/blog/communist/shu-lian-pou-fen-yang-xie
// https://pzy.blog.luogu.org/dsu-on-tree-xue-xi-bi-ji
// vals 为点权
// 模板题(点权)https://www.luogu.com.cn/problem/P3384
// todo 题单 https://www.luogu.com.cn/training/1654
Expand Down Expand Up @@ -594,6 +598,11 @@ func (*tree) hld(n, root int, g [][]int, vals []int64) {
_ = []interface{}{updatePath, queryPath, updateSubtree, querySubtree}
}

// 长链剖分
// 长链剖分和重链剖分一样,是把一棵树分成若干条不相交的链
// 但是,这里的重儿子不再是子树大小最大的,而是深度最大的子节点(长儿子)
// todo https://www.luogu.com.cn/blog/Ynoi/zhang-lian-pou-fen-xue-xi-bi-ji

// TODO: Morris Traversal
// https://www.cnblogs.com/anniekim/archive/2013/06/15/morristraversal.html

Expand Down
5 changes: 5 additions & 0 deletions copypasta/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,11 @@ func searchCollection() {

// 舞蹈链
// TODO: https://oi-wiki.org/search/dlx/
// https://leverimmy.blog.luogu.org/dlx-xiang-xi-jiang-jie
// https://www.luogu.com.cn/blog/Parabola/qian-tan-shen-xian-suan-fa-dlx

// 对抗搜索与 Alpha-Beta 剪枝
// https://www.luogu.com.cn/blog/pks-LOVING/zhun-bei-tou-ri-bao-di-fou-qi-yan-di-blog

_ = []interface{}{
valid, dfsGrids, findOneTargetAnyWhere, countTargetAnyWhere, reachable, bfsDis, findAllReachableTargets,
Expand Down
17 changes: 12 additions & 5 deletions copypasta/segment_tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ package copypasta
// https://codeforces.ml/blog/entry/15890
// https://algs4.cs.princeton.edu/code/edu/princeton/cs/algs4/SegmentTree.java.html

// todo zkw 线段树 https://codeforces.ml/blog/entry/18051
// todo 李超线段树 https://zhuanlan.zhihu.com/p/64946571
// todo zkw 线段树
// https://codeforces.ml/blog/entry/18051
// todo 李超线段树
// https://zhuanlan.zhihu.com/p/64946571
// https://www.luogu.com.cn/blog/fzber0103/Li-Chao-Tree

// LC 套题 https://leetcode-cn.com/tag/segment-tree/
// 题目推荐 https://cp-algorithms.com/data_structures/segment_tree.html#toc-tgt-12
Expand Down Expand Up @@ -240,6 +243,13 @@ func (t lazyST) queryAll() int64 { return t[1].sum }
//

// todo 权值线段树
// 浅谈权值线段树到主席树 https://www.luogu.com.cn/blog/your-alpha1022/WeightSegmentTree-ChairmanTree

//

// EXTRA: 线段树合并
// todo https://www.luogu.com.cn/blog/styx-ferryman/xian-duan-shu-ge-bing-zong-ru-men-dao-fang-qi
// todo https://www.luogu.com.cn/problem/P4556

//

Expand Down Expand Up @@ -353,6 +363,3 @@ func (t pst) queryKth(l, r, kth int) (allKth int) { return t._queryKth(t[l-1], t
//sortedArr := make([]int, n)
//copy(sortedArr, a)
//sort.Ints(sortedArr)

// EXTRA: 线段树合并
// todo https://www.luogu.com.cn/problem/P4556
9 changes: 9 additions & 0 deletions copypasta/sort.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,20 @@ func sortCollections() {
}

// 0-1 分数规划
// 与 0-1 背包结合,即最优比率背包
// 与生成树结合,即最优比率生成树
// 与负环判定结合,即最优比率环
// 与网络流结合,即最大密度子图
// 与费用流结合,即最优比率流
// 与其他的各种带选择的算法乱套,即最优比率啥啥的
// https://oi-wiki.org/misc/frac-programming/
// todo https://www.luogu.com.cn/blog/yestoday/post-01-fen-shuo-gui-hua-yang-xie

// CDQ 分治
// todo https://oi-wiki.org/misc/cdq-divide/
// https://www.bilibili.com/video/BV1mC4y1s7ic
// [学习笔记]CDQ分治和整体二分 https://www.luogu.com.cn/blog/Owencodeisking/post-xue-xi-bi-ji-cdq-fen-zhi-hu-zheng-ti-er-fen
// https://www.luogu.com.cn/blog/ljc20020730/cdq-fen-zhi-xue-xi-bi-ji

// 整体二分
// todo https://oi-wiki.org/misc/parallel-binsearch/
Expand Down
7 changes: 4 additions & 3 deletions copypasta/strings.go
Original file line number Diff line number Diff line change
Expand Up @@ -628,13 +628,14 @@ func (t *trie) acSearch(text string, patterns []string) [][]int {

// Suffix automaton (SAM)
// https://en.wikipedia.org/wiki/Suffix_automaton
//《后缀自动机》,陈立杰
//《后缀自动机在字典树上的拓展》,刘研绎
//《后缀自动机及其应用》,张天扬
// todo https://baobaobear.github.io/post/
// todo https://codeforces.ml/blog/entry/20861
// TODO https://oi-wiki.org/string/sam/
// TODO https://cp-algorithms.com/string/suffix-automaton.html
//《后缀自动机》,陈立杰
//《后缀自动机在字典树上的拓展》,刘研绎
//《后缀自动机及其应用》,张天扬
// 后缀树简介 https://eternalalexander.github.io/2019/10/31/%E5%90%8E%E7%BC%80%E6%A0%91%E7%AE%80%E4%BB%8B/
// 模板题 https://www.luogu.com.cn/problem/P3804

// 回文树 PAM
Expand Down

0 comments on commit c0aa2f7

Please sign in to comment.