随笔 - 530  文章 - 0  评论 - 3  阅读 - 10098 
06 2023 档案
1~n 线段覆盖
摘要:void solve(){ int r=a[1].r; int i=2, mx=0, ans=1; while(r<len){ mx=r; while(a[i].l<=r&&i<=len){ mx=max(mx,a[i].r); i++; } ans++ ; r=mx; } cout<<ans-1< 阅读全文
posted @ 2023-06-30 23:53 towboat 阅读(6) 评论(0) 推荐(0) 编辑
manacher 记录
摘要:首先注意 2* n 的长度 mx: 当前匹配到的最大长度 即 [1,mx] id: mx 对应的中心点 pi : s[i] 为中心的回文串的最大长度, pi /2 -1 是半径() #include <iostream> #include <cstring> #include <algorithm> 阅读全文
posted @ 2023-06-30 21:46 towboat 阅读(6) 评论(0) 推荐(0) 编辑
线段树区间赋值
摘要:https://www.luogu.com.cn/problem/P1253 区间赋,区间加,查询区间最大值 阅读全文
posted @ 2023-06-27 23:01 towboat 阅读(53) 评论(0) 推荐(0) 编辑
LIS (数据结构优化dp
摘要:首先是代码量小的bit 值域上建立bit, 需要注意合并类型应该有单调性 https://www.luogu.com.cn/problem/AT_dp_q https://www.luogu.com.cn/record/133869096 线段树 值域上建立线段树,区间查询,单点改 #include 阅读全文
posted @ 2023-06-27 00:22 towboat 阅读(149) 评论(0) 推荐(0) 编辑
静态区间第k小
摘要:可持久化线段树 #include <cstdio> #include <algorithm> using namespace std ; const int maxn=200010; int a[maxn],b[maxn],blen,n,CNT; int sum[maxn<<5],lc[maxn<< 阅读全文
posted @ 2023-06-22 15:00 towboat 阅读(10) 评论(0) 推荐(0) 编辑
P4556 [Vani有约会]雨天的尾巴 /【模板】线段树合并
摘要:线段树合并板子 #include<iostream> #include<cstring> using namespace std; const int N =5e5+10,M =N*2; int nxt[M],hd[N],all=1,go[M],n,m; int dep[N],f[N][22],fa 阅读全文
posted @ 2023-06-22 01:36 towboat 阅读(14) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示