摘要:
=============================以下是最小生成树+并查集====================================== 【HDU】 1213 How Many Tables 基础并查集★ 1272 小希的迷宫 基础并查集★ 1325&&poj1308 Is I 阅读全文
摘要:
割点 首先 tarjan 求割点, 对于不是割点的点, 答案是 2 (n 1) 有序,所以要乘 2 对于是割点的点, 答案是删去该点后所有连通块的个数加上 n 1 在乘 2 cpp include include include include include define ll long long 阅读全文
摘要:
强连通分量 一个结论: 在有向图中, 一个联通块能被所有点遍历当且仅当图中只有一个连通块出度为零 cpp include include include include include include include using namespace std; const int MAXN = 100 阅读全文
摘要:
FFT https://www.luogu.org/problemnew/solution/P3723 重点在于构造卷积的形式 cpp include include include include include include using namespace std; const int MAX 阅读全文
摘要:
讲解:http://www.cnblogs.com/poorpool/p/8760748.html 递归版FFT cpp include include include include include include using namespace std; const int MAXN = 400 阅读全文
摘要:
DP + 贪心 我们发现,如果只有一个窗口,贪心即可解决,吃饭时间长的人一定要先打饭 有两个窗口的时候,这条性质依然满足,但是两个窗口如何分配,需要 01 背包 cpp include include include include include using namespace std; cons 阅读全文
摘要:
有 k 条特殊边的生成树 我们发现有一些边是必须的,如果把所有的水泥路都加入并查集,再枚举鹅卵石路,如果这条路能再次加入并查集,说明这条路是必须的 水泥路同样 这样就把必需边求出来了,剩下就可以随意加边了 cpp include include include include include usi 阅读全文
摘要:
树型DP + 可并堆 非常清楚的想到是树型DP, 但是如何维护最小值, 于是就去新学了可并堆 cpp include include include include include define ll long long using namespace std; const int MAXN = 1 阅读全文
摘要:
可并堆,就是可以合并的堆 注意并查集不能路径压缩,不然删除根节点时会出错 cpp include include include include include include using namespace std; const int MAXN = 105005; int init() { in 阅读全文
摘要:
状压DP 发现本题中,每个小朋友是否高兴仅取决于其后五个动物的情况,我们可以用状压DP解决本题 首先已处理 num[i][s] 表示对于位置 i ,状态为 s 时有多少在 s 的同学满意 转移方程很好写 dp[i][s] = max(dp[i 1][(s&15) include include in 阅读全文
摘要:
```cpp include include include include include include include using namespace std; const int MAXN = 5005; int init() { int rv = 0, fh = 1; char c = g 阅读全文
摘要:
最短路计数模版 本题要注意重边的处理 cpp include include include include include include include using namespace std; const int MAXN = 2005; int head[MAXN], n, m, nume, 阅读全文
摘要:
tarjan 求 无向图的割边 (桥) 边 (x,y) 是桥当且仅当, 对于 x 的子节点 y ,low[x] include include include include include pragma comment(linker, "/STACK:16777216") include usin 阅读全文
摘要:
tarjan 求无向图的割点 割点,即割去此点后原图可变为两个或多个独立的联通块 一个点 x 是割点,当且仅当存在一个x 的子节点 y ,使得 low[y] = dfn[x] 对于根节点来说,需要两个满足的节点 cpp include include include include include 阅读全文
摘要:
点分治 非常巧妙的实现, 复杂度 O(n log ^2 n) https://www.cnblogs.com/GXZlegend/p/6641720.html cpp include include include include include include using namespace st 阅读全文
摘要:
线性基 +博弈论 先手必胜当且仅当先手取完之后留下的序列无论如何组合,异或和都不为 0 也就是剩下的整数线性无关,所以我们对所有整数排序,由高往低的贪心的插入线性基, 无法插入的就有先手取出,容易发现,先手必胜 cpp include include include include include 阅读全文
摘要:
矩阵快速幂 按列递推 cpp include include include include include include define ll long long using namespace std; const int MOD = 10000007; int n, m; struct Mat 阅读全文