跳到主要内容

基础模板

基础模板题

薛润泽提供
题目链接难度标签
Floydhttps://www.luogu.com.cn/problem/B3647n^3或n^2logn复杂度计算全源最短路
质数筛https://www.luogu.com.cn/problem/P5736埃氏筛欧拉筛
求第 k 小的数https://www.luogu.com.cn/problem/P1923分治快速排序思想
队列https://www.luogu.com.cn/problem/B3616STL queue
最长上升子序列https://www.luogu.com.cn/problem/B3637动态规划
单源最短路径(弱化版)https://www.luogu.com.cn/problem/P3371图论基础算法dijkstra
单源最短路径(标准版)https://www.luogu.com.cn/problem/P4779图论基础算法dijkstra
https://www.luogu.com.cn/problem/P3378STL priority_queue
最近公共祖先(LCA)https://www.luogu.com.cn/problem/P3379nlogn倍增
【模板】ST 表 && RMQ 问题https://www.luogu.com.cn/problem/P3865O(1)查询倍增
单调栈https://www.luogu.com.cn/problem/P5788单调性
传递闭包https://www.luogu.com.cn/problem/B3611传递闭包Floyd
最长公共子序列https://www.luogu.com.cn/problem/P1439动态规划最长上升子序列
石子合并https://www.luogu.com.cn/problem/P1880区间动态规划
Nim 游戏https://www.luogu.com.cn/problem/P2197博弈论
强连通分量https://www.luogu.com.cn/problem/B3609tarjan
缩点https://www.luogu.com.cn/problem/P3387tarjan强连通分量
割点(割顶)https://www.luogu.com.cn/problem/P3388tarjan强连通分量
线段树 1https://www.luogu.com.cn/problem/P3372线段树
线段树 2https://www.luogu.com.cn/problem/P3373线段树lazy-tag
树状数组 1https://www.luogu.com.cn/problem/P3374树状数组
树状数组 2https://www.luogu.com.cn/problem/P3368树状数组
差分约束https://www.luogu.com.cn/problem/P5960dijkstra图论
网络最大流https://www.luogu.com.cn/problem/P3376网络最大流图论
左偏树/可并堆https://www.luogu.com.cn/problem/P3377左偏树可并堆