
数据结构-树
LucienShui
因为孤独是人之常态,所以陪伴才显得格外可贵。
展开
-
非诚勿扰 - HDU 4557 - Treap入门
链接: http://acm.hdu.edu.cn/showproblem.php?pid=4557题目:Problem Description 作为2013年699万应届毕业生中的一员,由于宏观经济的不景气,小明在毕业当天就华丽丽地失业了! 经历了千难万苦的求职过程,小明特别能理解毕业生的就业之难,所以,他现在准备创建一家专门针对IT人才的求职中介公司——非诚勿扰人力资源开发有限公司。原创 2017-08-19 21:15:50 · 512 阅读 · 0 评论 -
UPCOJ-5531 [COCI 2017-2018-1] - Deda - 线段树 + 二分
链接: http://exam.upc.edu.cn/problem.php?id=5531 题目: 题目描述 Little Marica is making up a nonsensical unusual fairy tale and is telling to her grandfather who keeps interrupting her and asking her原创 2018-01-27 00:05:33 · 993 阅读 · 0 评论 -
Codeforces 842C - Ilya And The Tree - 树形DP或DFS
链接: http://codeforces.com/contest/842/problem/C题目:Ilya is very fond of graphs, especially trees. During his last trip to the forest Ilya found a very interesting tree rooted at vertex 1. There is an i原创 2017-08-31 00:55:16 · 721 阅读 · 0 评论 -
POJ 1617 - Phone List - 字典树
链接: http://acm.hdu.edu.cn/showproblem.php?pid=1671题目:Problem DescriptionGiven a list of phone numbers, determine if it is consistent in the sense that no number is the prefix of another. Let’s say the原创 2017-08-31 00:29:44 · 323 阅读 · 0 评论 -
[模板] 二叉堆 - 优先队列的二叉堆数组实现
最近开始学数据结构,一直无心更新博客,今天结束集训,晚上打算码一下最近的进度。/* * 创建一个最大容量为MaxSize的int型堆:MaxHeap<int> que(MaxSize); * 默认最大容量为1007:MaxHeap<int> que; * * 作为优先队列: * pop(); 同优先队列pop(),如果队列已为空还要执行pop,就会执行死循环以报错。原创 2017-08-19 20:53:37 · 462 阅读 · 0 评论 -
「模板」 左偏树 - 实现可并优先队列
template<typename T, typename _Compare=std::less<T> > class leftist_tree { private: struct node { T data; int deep; node *l, *r; node(const T &d) : data(d), deep(1),原创 2017-08-19 23:47:35 · 534 阅读 · 0 评论 -
[模板] 树堆 - Treap的指针和数组实现及一些例题
指针版:template <class T, class Compare = std::less<T> > class Treap { private: struct treap {//成员结构体 int size, fix;//以当前节点为根的树的节点数目,和调整树结构的fix随机数 T key;//每个节点的权,可以定义成自己想要的类型 C原创 2017-08-19 21:11:15 · 692 阅读 · 0 评论 -
Double Queue - POJ 3481 - 树堆Treap的数组实现
链接: 题目:DescriptionThe new founded Balkan Investment Group Bank (BIG-Bank) opened a new office in Bucharest, equipped with a modern computing environment provided by IBM Romania, and using modern infor原创 2017-08-19 23:27:24 · 488 阅读 · 0 评论 -
Shaolin - HDU 4585 - 树堆
链接: http://acm.hdu.edu.cn/showproblem.php?pid=4585题目:Problem DescriptionShaolin temple is very famous for its Kongfu monks.A lot of young men go to Shaolin temple every year, trying to be a monk there原创 2017-08-19 21:21:34 · 607 阅读 · 0 评论 -
Black Box - POJ 1442 - Treap
链接: http://poj.org/problem?id=1442题目:DescriptionOur Black Box represents a primitive database. It can save an integer array and has a special i variable. At the initial moment Black Box is empty and i原创 2017-08-19 22:57:38 · 477 阅读 · 0 评论 -
UPC-5911 - 计数问题 - 二维树状数组
题解链接: https://lucien.ink/archives/124/ 题目链接: http://exam.upc.edu.cn/problem.php?id=5911 题目: 题目描述 一个n*m的方格,初始时每个格子有一个整数权值。接下来每次有2种操作: 改变一个格子的权值; 求一个子矩阵中某种特定权值出现的个数。 输入 第一行有两个数n,m。 接下...原创 2018-03-20 15:48:02 · 395 阅读 · 0 评论