摘要: merge 其实有一个很吊的函数:merge #include <bits/stdc++.h> using namespace std; int main() { vector<int> fi={5,10,15,20,25}; vector<int> se={7,17,27,37,47,57}; v 阅读全文
posted @ 2026-04-11 15:27 wtnbl 阅读(5) 评论(0) 推荐(0)
摘要: int findf(int x) { int root = x; while(fa[root] != root) root = fa[root]; // 先找到根 // 路径压缩 while(x != root) { int nxt = fa[x]; fa[x] = root; x = nxt; } 阅读全文
posted @ 2026-04-11 10:36 wtnbl 阅读(4) 评论(0) 推荐(0)
摘要: 用于树上面求一段路经上的区间 #include <bits/stdc++.h> #define int long long // 把 int 统一改成 long long,防止数值溢出 #define lson l,mid,k*2 // 线段树左儿子的参数 #define rson mid+1,r, 阅读全文
posted @ 2026-03-28 12:30 wtnbl 阅读(6) 评论(0) 推荐(0)
摘要: 题目:线段树模板1 #include <bits/stdc++.h> #define int long long #define lson l,(l+r)/2,k*2 #define rson (l+r)/2+1,r,k*2+1 using namespace std; const int N=1e 阅读全文
posted @ 2026-03-13 20:29 wtnbl 阅读(5) 评论(0) 推荐(0)
摘要: 什么是原根 原根是指一个整数 g(1 ≤ g < n,且 gcd(g, n) = 1),使得 g 的幂次能够生成所有与 n 互素的整数(即乘法群 (Z/nZ)* 的生成元) 什么数有原根 \[2,4,p^k,2p^k \]p是奇素数 阅读全文
posted @ 2026-01-10 08:15 wtnbl 阅读(9) 评论(0) 推荐(0)
摘要: #include <bits/stdc++.h> using namespace std; const int MAXN = 1e7 + 10; const double Pi = acos(-1.0); struct Complex { double x, y; Complex (double x 阅读全文
posted @ 2026-01-07 15:03 wtnbl 阅读(4) 评论(0) 推荐(0)
摘要: IMG_1202 公式: \[f(k)=\sum_{i=0}^n y_i\frac{\prod_{i \ne j}(x-x_j)}{\prod_{i\ne j}(x_i-x_j)} \]那么怎么算系数? 在计算求和符号里面的每一项的时候,注意\(\frac{y_i}{\prod_{i\ne j}(x 阅读全文
posted @ 2025-12-27 14:21 wtnbl 阅读(10) 评论(0) 推荐(0)
摘要: int add(int a, int b){return a + b < mod ? a + b : a + b - mod;} int mpow(int a, int b) { int c = 1; for(;b;b>>=1, a = mul(a, a)){ if(b & 1) c = mul(a 阅读全文
posted @ 2025-12-26 21:22 wtnbl 阅读(9) 评论(0) 推荐(0)
摘要: 莫队模板题 相当于优化的暴力,每一次调整左右节点的位置 #include <bits/stdc++.h> using namespace std; int n,m,k; const int N=5e4+5; int a[N]; int cnt[N];//用于计算当前区间i出现了几次 int ans[ 阅读全文
posted @ 2025-11-22 16:54 wtnbl 阅读(15) 评论(0) 推荐(0)
摘要: #include <bits/stdc++.h> using namespace std; const int N=2e5+5; int n,cnt=0,didx=0,idx[N],ans[N];//这里idx[i]表示第i个模式串对应的idx编号 string s[N]; struct Node 阅读全文
posted @ 2025-11-13 21:33 wtnbl 阅读(9) 评论(0) 推荐(0)