上一页 1 ··· 31 32 33 34 35
摘要: posted on 2021-11-27 22:37:04 | under 模板 | source sto crxis 注:不是 tarjan void crxis(int u){ for(int i=g.head[u];i;i=g.nxt[i]){ int v=g[i].v; if(dep[v]= 阅读全文
posted @ 2022-11-06 19:16 caijianhong 阅读(27) 评论(0) 推荐(0) 编辑
摘要: posted on 2022-07-20 18:59:16 | under 模板 | source 0x00 模板(P3806) 给定 $n,k$ 和一棵树,计算 $$\sum\limits_{i,j\leq n}[{\tt dist}(i,j)=k]$$ 即树上距离为 $k$ 的点对数量。 点分治 阅读全文
posted @ 2022-11-06 19:12 caijianhong 阅读(42) 评论(0) 推荐(0) 编辑
摘要: posted on 2021-09-12 15:49:52 | under 模板 | source 感觉不如直接复制 template <int N> struct dsu { int fa[N + 10], siz[N + 10], cnt; explicit dsu(int n = N) : c 阅读全文
posted @ 2022-11-06 19:12 caijianhong 阅读(98) 评论(0) 推荐(0) 编辑
摘要: posted on 2022-07-22 19:15:58 | under 模板 | source template<int N,class T=int,int logN=20> struct STable{ int tot,lg[N+10];T f[logN+1][N+10]; STable(): 阅读全文
posted @ 2022-11-06 19:12 caijianhong 阅读(14) 评论(0) 推荐(0) 编辑
摘要: posted on 2022-10-18 13:30:17 | under 模板 | source const char* name="bit"; #include <cstdio> #include <cstring> #include <algorithm> using namespace st 阅读全文
posted @ 2022-11-06 19:11 caijianhong 阅读(15) 评论(0) 推荐(0) 编辑
摘要: posted on 2022-08-17 18:05:59 | under 模板 | source template<int N> struct lctree{ int val[N+10],sum[N+10],fa[N+10],ch[N+10][2],rev[N+10]; bool getson(i 阅读全文
posted @ 2022-11-06 19:11 caijianhong 阅读(10) 评论(0) 推荐(0) 编辑
摘要: posted on 2022-07-21 17:03:54 | under 模板 | source (介绍等会补) 调试: getpre、getsuf、find 手写,常数不要乘以二。 UB:getkth 和 getrnk 叠起来的时候 root 会改! UB:getpre、getsuf 的 val 阅读全文
posted @ 2022-11-06 19:11 caijianhong 阅读(13) 评论(0) 推荐(0) 编辑
摘要: posted on 2022-02-04 18:11:33 | under 模板 | source int popcount(int x){ #define BIT2(n) n,n+1,n+1,n+2 #define BIT4(n) BIT2(n),BIT2(n+1),BIT2(n+1),BIT2( 阅读全文
posted @ 2022-11-06 19:11 caijianhong 阅读(79) 评论(0) 推荐(0) 编辑
摘要: posted on 2022-08-10 18:07:25 | under 模板 | source 0x00 Bellman-Ford 最短路经过的边数不超过 $n-1$,因此若松弛轮数达到 $n$ 轮即有负环。复杂度 $O(nm)$。 int dis[100010]; bool vis[10001 阅读全文
posted @ 2022-11-06 19:11 caijianhong 阅读(33) 评论(0) 推荐(0) 编辑
摘要: posted on 2022-06-11 11:17:10 | under 模板 | source template<int N,int M=26,int D='a'> struct acam{ int ch[N+10][M],cnt[N+10],tot,fail[N+10]; int sum[N+ 阅读全文
posted @ 2022-11-06 19:11 caijianhong 阅读(13) 评论(0) 推荐(0) 编辑
摘要: posted on 2022-01-17 16:13:39 | under 模板 | source #include <cstdio> #include <cstring> #include <algorithm> using namespace std; template<int N,int M= 阅读全文
posted @ 2022-11-06 19:11 caijianhong 阅读(19) 评论(0) 推荐(0) 编辑
摘要: 你好,博客园!——2022.11.6 阅读全文
posted @ 2022-11-06 18:28 caijianhong 阅读(196) 评论(0) 推荐(0) 编辑
上一页 1 ··· 31 32 33 34 35