树链剖分
.
做一只大熊猫
让优秀成为一种习惯!
展开
-
AC自动机模板
知识点 视频讲解 文章讲解 LuoguP3808【模板】AC 自动机(简单版) #include <bits/stdc++.h> using namespace std; const int N = 1e6 + 10; int n; char s[N]; namespace AC { int tr[N][26], tot; int e[N], fail[N]; //e[i] 表示以 i 这个节点编号位置为结尾的单词有多少个 void insert(char s[]) {原创 2021-05-26 21:00:27 · 105 阅读 · 0 评论 -
树链剖分——模板
知识点讲解 视频讲解 博客讲解 1 博客讲解 2 oi-wiki 讲解 重链刨分代码 #include <iostream> #include <stdio.h> #include <string.h> #include <math.h> #include <algorithm> #include <string> #include <queue> #include <map> #include <bi原创 2021-04-14 10:54:48 · 81 阅读 · 0 评论 -
A - 搭配飞行员 LibreOJ - 6000(最大流 或 二分图最大匹配)
题意 总共用 n 个点,这个 n 个点可以被分割成两个集合中去,我们假设为 左集合 L、右集合 R,其中 L 中的元素只能与 R 中的某些元素进行匹配,问左集合 L 中的元素最大可以和 R 中的集合一对一形成的最大匹配数是多少? 思路 因为这题中的点可以备份为两个集合,所以是让求的二分图最大匹配,如果不能被分成两个集合,那就要用 一般图的二分图最大匹配算法(带花树算法)了, 二者这题我们只需要 跑一个二分图最大匹配就行了, 或者建图跑网络流, 虚拟出一个 超级源点是 S 与 L 集合中的元素相连,流原创 2021-03-24 21:02:45 · 147 阅读 · 0 评论