![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构
TLE分治的WA自动机
eli eli lama sabachthani
展开
-
HDU 4578 Transformation 懒标记
题目链接:HDU 4578 Transformation题目Problem DescriptionYuanfang is puzzled with the question below:There are n integers, a1, a2, …, an. The initial values of them are 0. There are four kinds of operati...原创 2019-10-19 23:25:27 · 172 阅读 · 0 评论 -
POJ 1177 Picture 线段树+扫描线
题目链接:POJ 1177 Picture题目DescriptionA number of rectangular posters, photographs and other pictures of the same shape are pasted on a wall. Their sides are all vertical or horizontal. Each rectangle...原创 2019-10-04 16:35:53 · 158 阅读 · 0 评论 -
UVA 1619 Feel Good 线段树二分
题目链接:UVA 1619 Feel Good题目DescriptionBill is developing a new mathematical theory for human emotions. His recent investigations are dedicated to studying how good or bad days influent people’s memo...原创 2019-09-13 10:41:49 · 219 阅读 · 0 评论 -
POJ 2182 Lost Cows 权值线段树
题目链接:POJ 2182 Lost Cows题目DescriptionN (2 <= N <= 8,000) cows have unique brands in the range 1…N. In a spectacular display of poor judgment, they visited the neighborhood ‘watering hole’ and...原创 2019-09-11 22:01:50 · 155 阅读 · 0 评论 -
POJ 2482 Stars in Your Window 线段树+扫描线
题目DescriptionFleeting time does not blur my memory of you. Can it really be 4 years since I first saw you? I still remember, vividly, on the beautiful Zhuhai Campus, 4 years ago, from the moment I s...原创 2019-09-05 16:38:11 · 169 阅读 · 0 评论 -
POJ 1151 Atlantis 线段树扫描线
题目DescriptionThere are several ancient Greek texts that contain descriptions of the fabled island Atlantis. Some of these texts even include maps of parts of the island. But unfortunately, these map...原创 2019-09-04 23:06:27 · 135 阅读 · 0 评论 -
BZOJ-4318 OSU! 概率DP
题目链接:BZOJ-4318 OSU!题目Descriptionosu 是一款群众喜闻乐见的休闲软件。我们可以把osu的规则简化与改编成以下的样子:一共有n次操作,每次操作只有成功与失败之分,成功对应1,失败对应0,n次操作对应为1个长度为n的01串。在这个串中连续的 X个1可以贡献X^3 的分数,这x个1不能被其他连续的1所包含(也就是极长的一串1,具体见样例解释)现在给出n,以及...原创 2019-08-17 17:25:29 · 155 阅读 · 0 评论 -
数据结构——ST表
定义倍增查询表作用区间查询,单点多层次查询,求LCA原理倍增思想,能够快速向上推进查询。模板void init(){ for(int j = 1; j < 20; j++) for(int i = 1; i <= n; i++) st[i][j] = st[st[i][j-1]][j-1];}int query(int a, int b) /...原创 2019-07-27 21:08:15 · 191 阅读 · 0 评论 -
HDU-6621 主席树+二分优化
题目链接:HDU-6621 K-th Closest Distance题目Problem DescriptionYou have an array: a1, a2, , an and you must answer for some queries.For each query, you are given an interval [L, R] and two numbers p an...原创 2019-08-03 16:41:49 · 80 阅读 · 0 评论 -
数据结构——静态主席树(主席树第一部分)
定义可持久化线段树。据说是某大佬学不会划分树,所以自己研究出了这一更为高效的算法(不愧是大佬,%%%)。由于主席树博大精深,这里分成几种类型的主席树分别讨论(无修改,维护修改)。作用查询区间内某个数出现次数、查找区间第kkk大值。原理学主席树,首先要学会权值线段树。权值线段树的概念比较基础。我给你一个数组aaa,你统计出这个数组里有那些数,排个序,再另开一个数组bbb储存这些数各自的出现...原创 2019-08-03 16:40:21 · 1326 阅读 · 0 评论 -
数据结构——树状数组
定义树状的数组 (废话,你就是偷懒不想查)作用求出一段区间元素计算得到的值原理其实就是简化过的线段树啦 (你是不是懒癌发作了)不过树状数组求出的是从1开始的连续区间,若不从1开始,还得计算两个值再对这两个值计算得出答案模板#define lowbit(x) x&(-x) int tree[maxn]; void build(int n){ for(int i = 1...原创 2019-07-18 16:55:51 · 112 阅读 · 0 评论 -
数据结构——单调队列
定义内部元素单调递增/递减的队列操作作用求出一个数组内第一个大于等于一个数x的数求出数组里每个定长连续区间的最值原理加入一个元素时,若队列不为空且队尾元素大于/小于当前元素的值时,弹出队尾,重复该操作直至队列为空或队尾元素小于等于/大于等于新元素,新元素入队模板while(!dq.empty()) dq.pop_back();for(int j = 1; j <= b; j...原创 2019-07-18 12:31:39 · 168 阅读 · 0 评论