数据结构
小伙子开的什么车啊
这个作者很懒,什么都没留下…
展开
-
HDU1255-覆盖的面积(扫描线求面积并)
覆盖的面积Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 6599 Accepted Submission(s): 3366Problem Description 给定平面上若干矩形,求出被这些矩形覆盖过至少两次的区域原创 2018-01-30 20:33:56 · 249 阅读 · 0 评论 -
SPOJ-DQUERY - D-query(主席数,区间不同元素个数)
题意:多次询问一段区间中不同元素的个数 思路:主席树入门题,建N棵线段树,每颗记录区间[1,n]区间中每个元素最后出现的位置。查询的时候直接相减。#include <stdio.h>#include <algorithm>using namespace std;const int maxn=1e5+100;int a[maxn],root[maxn],f[...原创 2018-07-08 16:46:09 · 365 阅读 · 0 评论 -
SPOJ3273——ORDERSET - Order statistic set(Treap)
In this problem, you have to maintain a dynamic set of numbers which support the two fundamental operationsINSERT(S,x): if x is not in S, insert x into S DELETE(S,x): if x is in S, delete x from S ...原创 2018-05-04 17:28:19 · 207 阅读 · 0 评论 -
POJ2892——Tunnel Warfare(Treap)
Tunnel Warfare Time Limit: 1000MS Memory Limit: 131072K Total Submissions: 9165 Accepted: 3786 DescriptionDuring the War of Resistance Against Japan, tunnel warfare was carried out exten...原创 2018-05-04 17:17:27 · 195 阅读 · 0 评论 -
hihocoder1325-平衡树·Treap
描述 小Ho:小Hi,我发现我们以前讲过的两个数据结构特别相似。小Hi:你说的是哪两个啊?小Ho:就是二叉排序树和堆啊,你看这两种数据结构都是构造了一个二叉树,一个节点有一个父亲和两个儿子。 如果用1..n的数组来存储的话,对于二叉树上的一个编号为k的节点,其父亲节点刚好是k/2。并且它的两个儿子节点分别为k*2和k*2+1,计算起来非常方便呢。小Hi:没错,但是小Hi你知道有一种办...原创 2018-05-03 19:10:54 · 150 阅读 · 0 评论 -
POJ1442——Black Box(Treap)
Black Box Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 14319 Accepted: 5848 DescriptionOur Black Box represents a primitive database. It can save an integer array and ha...原创 2018-05-03 16:53:29 · 206 阅读 · 0 评论 -
POJ2985-The k-th Largest Group(Treap + 并查集)
The k-th Largest Group Time Limit: 2000MS Memory Limit: 131072K Total Submissions: 9639 Accepted: 3142 DescriptionNewman likes playing with cats. He possesses lots of cats in his home. B...原创 2018-05-03 16:09:57 · 251 阅读 · 0 评论 -
BZOJ2120-数颜色(带修改莫队)
2120: 数颜色 Time Limit: 6 Sec Memory Limit: 259 MB Submit: 7556 Solved: 3071 [Submit][Status][Discuss] Description 墨墨购买了一套N支彩色画笔(其中有些颜色可能相同),摆成一排,你需要回答墨墨的提问。墨墨会像你发布如下指令: 1、 Q L R代表询问你从第L支画笔到第R支画笔中原创 2018-03-16 15:31:00 · 176 阅读 · 0 评论 -
HDU4638-Group (莫队模板)
There are n men ,every man has an ID(1..n).their ID is unique. Whose ID is i and i-1 are friends, Whose ID is i and i+1 are friends. These n men stand in line. Now we select an interval of men to make原创 2018-03-16 15:20:17 · 294 阅读 · 0 评论 -
HDU4122-Alice's mooncake shop(单调队列)
The Mid-Autumn Festival, also known as the Moon Festival or Zhongqiu Festival is a popular harvest festival celebrated by Chinese people, dating back over 3,000 years to moon worship in China's Shang Dynasty. T原创 2018-01-29 16:30:51 · 170 阅读 · 0 评论 -
HDU1542-Atlantis(扫描线+离散化个人小结)
There 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 maps describe different regi原创 2018-01-29 15:32:51 · 272 阅读 · 0 评论 -
HDU6047-Maximum Sequence(单调队列)
Maximum SequenceSteph is extremely obsessed with “sequence problems” that are usually seen on magazines: Given the sequence 11, 23, 30, 35, what is the next number? Steph always finds them too easy for such a原创 2018-02-02 17:17:14 · 232 阅读 · 0 评论 -
HDU1828-Picture(扫描线求周长)
HDU 1828 PictureA 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 can be partially or totally c原创 2018-02-01 19:30:01 · 211 阅读 · 0 评论 -
HUD3954-Level up(线段树技巧)
题目大意:有N个英雄,初始为1级,0经验。有M波怪物,每波怪物选择区间[l,r]的英雄去打,打死每波怪物的英雄会获得k(等级)*ei的经验,现在给出升到每个等级所需要的经验,和每波怪物派出的英雄,每次询问一个区间内经验值最高的值。思路:一道线段树区间更新变形题,容易想到每次更新对每个子区间的改变是不同的,但是,对答案的英雄却是唯一的,假设一个区间的最大等级为lv,那么更新当v前区间...原创 2018-07-28 11:52:41 · 231 阅读 · 0 评论