随笔分类 - E - 数据结构
摘要:朴素AC自动机拓扑排序优化板子 求匹配次数: #include<bits/stdc++.h> using namespace std; const int N = 2e6 + 10; int n, fail[N], tr[N][26], tot, du[N], tans[N], id[N], ans
阅读全文
摘要:我花了很久时间终于明白我写不出h并不是因为我代码能力不行而是我不会主席树也不会线段树合并。
阅读全文
摘要:https://atcoder.jp/contests/abc378/tasks/abc378_e #include <bits/stdc++.h> using namespace std; #define int long long #define lowbit(x) (x&(-x)) #defi
阅读全文
摘要:本来写完了但是忘保存了。。寄
阅读全文
摘要:板子题 符合堆和二叉搜索树性质,treap也是一种特殊笛卡尔树 堆性质就是树下层元素的值都小于等于或大于等于上层元素的值 二叉搜索树是一个左儿子小于自身,右儿子大于自身的树,在笛卡尔树中,通常为数组索引 这时候就可以用单调栈来维护右链建树 #include<iostream> #include<al
阅读全文
摘要:可以再加一个struct把整个树封装起来。。跟oiwiki学的 #include<bits/stdc++.h> using namespace std; #include<bits/stdc++.h> using namespace std; struct Node{ Node *ch[2]; in
阅读全文