摘要: 最小生成树 容易想到按照边权合并 每次相当于计算当前联通块的方案数,依次合并即可 #include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 5, P = 1e9 + 7; struct data { int x, y, 阅读全文
posted @ 2019-09-08 21:54 19992147 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 欧拉回路 我们发现本质上就是加最少的边使得整个图可以分解成若干欧拉回路 那么我们对于每个联通快单独求解 如果已经是欧拉回路单独计算 其他的按照欧拉回路计算公式补全边数即可 #include <bits/stdc++.h> using namespace std; const int maxn = 1 阅读全文
posted @ 2019-09-08 21:51 19992147 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 置换群 对于一个大小为$n$的循环,走$k$步之后分解成$gcd(n,k)$个循环 现在相当于我们知道$a = gcd(n,k)$和$k$,分别合成最初的循环。 问题在于找出$n$,我们构造一个最小的$n$,这个$n$满足包含所有在$a$中出现的质因子的次数加上质因子在$k$中的出现次数 那么暴力枚 阅读全文
posted @ 2019-09-08 21:46 19992147 阅读(141) 评论(0) 推荐(0) 编辑
摘要: namespace flow { const int maxm = 1e5 + 5, maxn = 1e5 + 5, inf = 1e9; struct edge { int nxt, to, f; } e[maxm]; int cnt = 1, source, sink; int d[maxn], h[maxn], iter[maxn];... 阅读全文
posted @ 2019-09-08 20:20 19992147 阅读(157) 评论(0) 推荐(0) 编辑
摘要: namespace NTT { const int g = 3; int power(int x, int t) { int ret = 1; for(; t; t >>= 1, x = 1LL * x * x % P) if(t & 1) ret = 1LL * ret * x % P; return ret; } void NTT(int *a, int len, int f) { int n 阅读全文
posted @ 2019-09-08 20:07 19992147 阅读(524) 评论(0) 推荐(0) 编辑