todo:
- day24
- misc7
- misc8
- tanxin2
- day21
- day22
- graph1
- convex1
- misc6
- adhoc2
- 联合省选 2026
一些可能需要的东西:
分拆数:https://oeis.org/A000041/b000041.txt, 。
Bell 数:https://oeis.org/A000110/a000110.txt
质数:https://www.cnblogs.com/ljxtt/p/13514346.html
由 个大小分别为 的连通块所连接而成的有标号无根树的方案数为 。
将 个有标号点连成 棵无根树的方案数为 。
()
int inv(int x, int m) { return x == 1 ? 1 : m - 1LL * inv(m % x, x) * m / x; }pair<int, int> approx(int p, int q, int A) { // approx(998244353, 499122177, 100)={1,2}
int x = q, y = p, a = 1, b = 0;
while (x > A) {
swap(x, y); swap(a, b);
a -= x / y * b;
x %= y;
}
return make_pair(x, a);
}struct custom_hash {
static uint64_t splitmix64(uint64_t x) {
// http://xorshift.di.unimi.it/splitmix64.c
x += 0x9e3779b97f4a7c15;
x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
return x ^ (x >> 31);
}
size_t operator()(uint64_t x) const {
static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
return splitmix64(x + FIXED_RANDOM);
}
};u64 add(u64 a, u64 b, u64 MOD) { return a + b >= MOD ? a + b - MOD : a + b; }
u64 sub(u64 a, u64 b, u64 MOD) { return a >= b ? a - b : a - b + MOD; }
u64 mul(u64 a, u64 b, u64 MOD) {
long long r = a * b - (u64)((long double)a * b / MOD) * MOD;
if (r < 0) {
r += MOD;
}
return r % MOD;
}fast io: https://www.luogu.com.cn/paste/2jw1qdjx
fss: https://www.luogu.com.cn/paste/p3uw6set
fps: https://www.luogu.com.cn/paste/45tigrd5
bitset: https://www.luogu.com.cn/paste/vxwnuxzg
modint (montgomery): https://www.luogu.com.cn/paste/uhgewqoc
modint (barrett): https://www.luogu.com.cn/paste/cy0ovvsw
线性序列并查集: https://www.luogu.com.cn/paste/dmu5zbdx
压位 Trie: https://www.luogu.com.cn/paste/rgfcumhh
编译期随机质数: https://www.luogu.com.cn/paste/tepfpw36



