随笔分类 - 模板
摘要:[模板](https://www.luogu.com.cn/problem/P5180) ``` #include #include using namespace std; const int N = 200010, M = 300010; int n, m, ans[N], head[N][3]
阅读全文
摘要:``` #include mt19937_64 rnd(random_device{}()); uniform_int_distribution dist(0, ULLONG_MAX); long long r = dist(rnd); ```
阅读全文
摘要:模板 #include <cctype> #include <chrono> #include <cstdio> #include <random> #include <set> #include <vector> typedef unsigned long long ull; const ull
阅读全文
摘要:模板 #include <iostream> #include <cstdio> using namespace std; const int MOD = 998244353; int inv2, inv6, n, a, b, c; long long quickPower (long long x
阅读全文
摘要:连续的取点,时间复杂度 模板 #include <iostream> #include <cstdio> using namespace std; const int N = 60, MOD = 998244353; int n, k, fac[N], inv[N], pows[N][N
阅读全文
摘要:inline void solve (int n) { for (int i = 1, top = 1; i <= n; i ++, top ++) { int cur = 0; for (int j = top; j <= n; j ++) if (mat[j][i]) { cur = j; br
阅读全文
摘要:[模板](https://www.luogu.com.cn/problem/P4195) ```cpp #include #include #include #include using namespace std; const int HashMod = 191981; long long a,
阅读全文
摘要:模板 #include <iostream> #include <cstdio> using namespace std; const int MAXN = 62; int n, top; long long p[65], a[65]; bool zero; inline void insert (
阅读全文
摘要:模板 #include <iostream> #include <cstdio> #include <cstring> using namespace std; const int N = 1000100; int n, m, q, nex[N], pre[N], top; char s[N], t
阅读全文
摘要:模板 #include <iostream> #include <cstdio> using namespace std; const int N = 100010; int n, c[N], head[N], ver[N << 1], nex[N << 1], tot, cnt[N], num[N
阅读全文
摘要:K #include <iostream> #include <cstdio> #include <vector> using namespace std; const int N = 2000010; int n, m, head[N], ver[N << 1], nex[N << 1], tot
阅读全文
摘要:#include <iostream> #include <cstdio> #include <vector> #include <cmath> #include <algorithm> using namespace std; const double eps = 1e-8; const doub
阅读全文
摘要:题目链接 #include <iostream> #include <cstdio> #include <set> using namespace std; const int N = 100010; int t, n, m, a[N], ans[N]; struct P { int l, r, v
阅读全文
摘要:#include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <vector> #define clr(f, n) memset(f, 0, sizeof(int) * (n)) #def
阅读全文
摘要:题目链接 #include <iostream> #include <cstdio> #include <cmath> #include <algorithm> using namespace std; const int N = 1000010, Q = 1000010; int n, q, le
阅读全文
摘要:#include <iostream> #include <cstdio> using namespace std; const int N = 1000010, hashBase[2] = {29, 31}, hashMod[2] = {1000000007, 1000000009}, hashN
阅读全文
摘要:线性筛约数个数 #include <iostream> #include <cstdio> using namespace std; const int N = 10000000; int n, prime[N + 1], dnum[N + 1]; void init (int n) { dnum[
阅读全文