Data structure
文章平均质量分 79
安静de想着网名
300字以内
展开
-
Gym - 100971D==Laying Cables【单调栈】
One-dimensional country has n cities, the i-th of which is located at the point xi and has population pi, and all xi, as well as all pi, are distinct. When one-dimensional country got the Internet, it...原创 2018-07-21 21:53:27 · 339 阅读 · 0 评论 -
HDU3577【线段树+区间更新+最值查询】
Fast ArrangementProblem DescriptionChinese always have the railway tickets problem because of its’ huge amount of passangers and stations. Now goverment need you to develop a new tickets query s...原创 2018-07-18 20:39:51 · 644 阅读 · 0 评论 -
splay
#include<iostream>#include<stdio.h>#include<string>#include<string.h>#include<algorithm>using namespace std;const int MAXN = 100000 + 55;int L[MAXN], R[MAXN], F[MA...原创 2018-04-27 19:06:44 · 171 阅读 · 0 评论 -
LCA 模板tarjan,欧拉序
#include&lt;iostream&gt;#include&lt;stdio.h&gt;#include&lt;vector&gt;#include&lt;algorithm&gt;#include&lt;string.h&gt;using namespace std;typedef long long LL;const int原创 2018-04-26 16:42:18 · 183 阅读 · 0 评论 -
线段树(动态建点)
敌兵布阵原创 2018-03-05 18:24:08 · 370 阅读 · 0 评论 -
二维线段树之降维打击
COCI 2017/2018 ROUND#1DedaLittle Marica is making up a nonsensical unusual fairy tale and is telling to her grandfatherwho keeps interrupting her and asking her stupid intriguing questions.In Mar...原创 2018-03-12 12:21:19 · 451 阅读 · 0 评论 -
Yet Another Tree Query Problem(二维线段树)
Yet Another Tree Query Problem原创 2018-03-11 11:54:20 · 363 阅读 · 0 评论 -
主席树——区间第K大
Kth number原创 2017-09-27 21:51:33 · 276 阅读 · 0 评论 -
AC自动机 模板
struct trie原创 2017-09-26 23:16:49 · 172 阅读 · 0 评论 -
线段树plus
Just a HookHDU1698Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Problem DescriptionIn the game of DotA, Pudge’s meat hook is actually the most horrible thing for mo原创 2017-09-20 16:22:50 · 211 阅读 · 0 评论 -
可持久化线段树——主席树
支持访问任意历史版本以及在历史版本上修改的数据结构 每次修改不是在原有线段树上直接修改,而是在旁边新建点。 时空复杂度都是O(mlogn) const int N = 100000 + 5;//点数long long tree[N * 25], add_num[N * 25];int total, left_child[N * 25], right_child[N * 25], r...原创 2017-08-14 18:32:49 · 303 阅读 · 0 评论 -
二分排序(搜索)树
二叉排序树的查找过程和次优二叉树类似,通常采取二叉链表作为二叉排序树的存储结构。中序遍历二叉排序树可得到一个关键字的有序序列,一个无序序列可以通过构造一棵二叉排序树变成一个有序序列,构造树的过程即为对无序序列进行排序的过程。每次插入的新的结点都是二叉排序树上新的叶子结点,在进行插入操作时,不必移动其它结点,只需改动某个结点的指针,由空变为非空即可。搜索,插入,删除的复杂度等于树高,O(log(n))原创 2017-08-11 18:49:49 · 476 阅读 · 0 评论 -
c++ STL之栈和队列
栈stack-先入后出FILO栈可以理解为一个坑,先掉坑里的被压在下面,等上面的走了才能出来 头文件 入栈 push(某东西);栈顶元素出栈 pop();是否为空 empty(); 空返回1 非空返回0大小 size(); 返回元素个数查看栈顶原创 2017-08-11 18:39:35 · 337 阅读 · 0 评论 -
线段树(初级)
#define MAX 10000 //待处理的点数,不是树中的节点数int tree[MAX * 4];void build(int t, int l, int r){ if (l == r) { //cin>>tree[t]; //tree[t]=0; //对叶子初始化 return; }原创 2017-08-11 18:05:55 · 161 阅读 · 0 评论 -
acm 模板
卢卡斯定理 主席树 Sunday AC自动机 链式前向星#include&amp;amp;lt;string.h&amp;amp;gt;#define MAX 10000struct node{ int to,nex,wei;}edge[MAX*2+5];int head[MAX+5],cnt;void add(int u,int v,int w)//添加一个单向边u-&amp;amp;gt;v 权为w {...原创 2017-08-11 17:47:51 · 296 阅读 · 0 评论 -
线段树
线段树是一个用一个数组,想象一棵完全二叉树,赋予其一些意义,数组中存储的信息即为每个节点数组中的0 是不用的。原创 2017-08-10 19:44:04 · 163 阅读 · 0 评论 -
Call of Accepted【中缀表达式】2018ICPC沈阳网络赛
Call of AcceptedYou and your friends are at the table, playing an old and interesting game - the Call of Cthulhu. There is a mechanism in the game: rolling the dice. You use a notation to communica...原创 2018-09-08 18:52:10 · 311 阅读 · 0 评论