数据结构
文章平均质量分 77
安庆闪耀
这个作者很懒,什么都没留下…
展开
-
hdu 5678 ztr loves trees(求子树第k大 线段树套主席树)
ztr loves treesProblem DescriptionSuper Deity ztr likes trees from childhood,CCTV-children:"The apple on the apple tree.You and I under the apple tree.Play games in front of the apple tree.S原创 2016-05-01 14:30:54 · 11030 阅读 · 0 评论 -
hdu 1542 Atlantis(矩形面积并)
Problem 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, t原创 2016-04-10 20:31:42 · 448 阅读 · 0 评论 -
hdu 3795 Billboard(线段树)
Problem DescriptionAt the entrance to the university, there is a huge rectangular billboard of size h*w (h is its height and w is its width). The board is the place where all possible announcement原创 2016-04-10 20:26:19 · 480 阅读 · 0 评论 -
hdu 4251 The Famous ICPC Team Again(划分树)
Problem DescriptionWhen Mr. B, Mr. G and Mr. M were preparing for the 2012 ACM-ICPC World Final Contest, Mr. B had collected a large set of contest problems for their daily training. When they dec原创 2016-04-10 20:24:27 · 357 阅读 · 0 评论 -
hdu 3183 A Magic Lamp(ST表)
Problem DescriptionKiki likes traveling. One day she finds a magic lamp, unfortunately the genie in the lamp is not so kind. Kiki must answer a question, and then the genie will realize one of her dre原创 2016-04-10 20:10:23 · 421 阅读 · 0 评论 -
poj 3468 A Simple Problem with Integers(线段树成段更新lazy)
DescriptionYou have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval. The other is原创 2016-03-30 14:22:44 · 244 阅读 · 0 评论 -
hdu 1698 Just a Hook(线段树成段更新lazy)
Problem DescriptionIn the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metallic sticks which are of the sa原创 2016-03-30 14:20:54 · 251 阅读 · 0 评论 -
hdu 1754 I Hate It(线段树单点更新求区间最大值)
Problem Description很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。 Input本题目包含多组测试,请处理到文件结束。在每个测试的第一行,有两个正整数 N原创 2016-03-30 14:17:40 · 415 阅读 · 0 评论 -
hdu 1166 敌兵布阵(线段树单点更新求和)
Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视原创 2016-03-30 14:14:50 · 488 阅读 · 0 评论 -
hdu 5122 K.Bro Sorting(单调栈)
Problem DescriptionMatt’s friend K.Bro is an ACMer.Yesterday, K.Bro learnt an algorithm: Bubble sort. Bubble sort will compare each pair of adjacent items and swap them if they are in the wron原创 2016-03-06 13:54:12 · 290 阅读 · 0 评论 -
hdu 5631 Rikka with Graph(并查集)
Rikka with GraphTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 593 Accepted Submission(s): 274Problem DescriptionAs we know,原创 2016-02-27 10:55:17 · 291 阅读 · 0 评论 -
hdu 1698 Just a Hook(线段树区间更新求和)
Just a HookTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 24532 Accepted Submission(s): 12230Problem DescriptionIn the g原创 2015-12-24 16:37:03 · 517 阅读 · 0 评论 -
hdu 1757 I Hate It(线段树求区间最值)
I Hate ItTime Limit: 9000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 55716 Accepted Submission(s): 21740Problem Description很多学校流行一种比较原创 2015-12-24 16:29:24 · 284 阅读 · 0 评论 -
bzoj 1029: [JSOI2007]建筑抢修(贪心+优先队列)
Description 小刚在玩JSOI提供的一个称之为“建筑抢修”的电脑游戏:经过了一场激烈的战斗,T部落消灭了所有z部落的入侵者。但是T部落的基地里已经有N个建筑设施受到了严重的损伤,如果不尽快修复的话,这些建筑设施将会完全毁坏。现在的情况是:T部落基地里只有一个修理工人,虽然他能瞬间到达任何一个建筑,但是修复每个建筑都需要一定的时间。同时,修理工人修理完一个建筑才能修理原创 2016-04-23 09:45:01 · 864 阅读 · 0 评论 -
bzoj 1012: [JSOI2008]最大数maxnumber(线段树)
Description 现在请求你维护一个数列,要求提供以下两种操作:1、 查询操作。语法:Q L 功能:查询当前数列中末尾L个数中的最大的数,并输出这个数的值。限制:L不超过当前数列的长度。2、 插入操作。语法:A n 功能:将n加上t,其中t是最近一次查询操作的答案(如果还未执行过查询操作,则t=0),并将所得结果对一个固定的常数D取模,将所得答案插入到数列的末尾。限制:原创 2016-04-23 09:48:35 · 451 阅读 · 0 评论 -
bzoj 1036: [ZJOI2008]树的统计Count(树链剖分 点权)
Description 一棵树上有n个节点,编号分别为1到n,每个节点都有一个权值w。我们将以下面的形式来要求你对这棵树完成一些操作: I. CHANGE u t : 把结点u的权值改为t II. QMAX u v: 询问从点u到点v的路径上的节点的最大权值 III. QSUM u v: 询问从点u到点v的路径上的节点的权值和 注意:从点u到点v的路径上的节点包括u和v本身原创 2016-04-23 09:54:02 · 1304 阅读 · 0 评论 -
hdu 1394 Minimum Inversion Number(线段树)
Minimum Inversion NumberTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 16802 Accepted Submission(s): 10219Problem Description原创 2016-06-10 19:16:38 · 752 阅读 · 0 评论 -
hdu 4288 Coder(线段树)
CoderTime Limit: 20000/10000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4993 Accepted Submission(s): 1920Problem Description In mathematics a原创 2016-06-10 19:25:08 · 747 阅读 · 0 评论 -
hdu 1556 Color the ball(线段树lazy)
Problem DescriptionN个气球排成一排,从左到右依次编号为1,2,3....N.每次给定2个整数a b(a Input每个测试实例第一行为一个整数N,(N 当N = 0,输入结束。 Output每个测试实例输出一行,包括N个整数,第I个数代表第I个气球总共被涂色的次数。 Sample Inpu原创 2016-04-10 20:34:21 · 410 阅读 · 0 评论 -
poj 3264 Balanced Lineup(ST)
DescriptionFor the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) always line up in the same order. One day Farmer John decides to organize a game of Ultimate Frisbee with some of the cows.原创 2016-04-10 20:38:29 · 393 阅读 · 0 评论 -
poj 3067 Japan(求逆序对)
DescriptionJapan plans to welcome the ACM ICPC World Finals and a lot of roads must be built for the venue. Japan is tall island with N cities on the East coast and M cities on the West coast (M <原创 2016-04-10 20:43:57 · 389 阅读 · 0 评论 -
hdu 5412 CRB and Queries(动态求区间第k小+整体二分)
Problem DescriptionThere are N boys in CodeLand.Boy i has his coding skill Ai.CRB wants to know who has the suitable coding skill.So you should treat the following two types of queries.原创 2016-05-01 20:16:29 · 3659 阅读 · 0 评论 -
hdu 5289 Assignment(尺取)
AssignmentTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 3192 Accepted Submission(s): 1468Problem DescriptionTom owns a comp原创 2016-05-01 20:20:03 · 4821 阅读 · 0 评论 -
hdu 2104 K-th Number(静态求区间第k小+整体二分)
K-th NumberTime Limit: 20000MS Memory Limit: 65536KTotal Submissions: 46551 Accepted: 15539Case Time Limit: 2000MSDescriptionYou are working for Macrohard c原创 2016-05-01 20:24:29 · 1141 阅读 · 0 评论 -
hdu 5437 Alisha’s Party(优先队列)
Alisha’s PartyTime Limit: 3000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 4167 Accepted Submission(s): 1069Problem DescriptionPrincess原创 2016-05-02 17:31:05 · 8092 阅读 · 0 评论 -
hdu 5441 Travel(带权并查集)
Problem DescriptionJack likes to travel around the world, but he doesn’t like to wait. Now, he is traveling in the Undirected Kingdom. There are n cities and m bidirectional roads connecting t原创 2016-05-02 20:23:04 · 2753 阅读 · 1 评论 -
hdu 5443 The Water Problem(求区间最值+ST表)
The Water ProblemTime Limit: 1500/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 1196 Accepted Submission(s): 942Problem DescriptionIn Land原创 2016-05-02 20:34:42 · 1114 阅读 · 0 评论 -
hdu 5444 Elven Postman(二叉搜索树)
Elven PostmanTime Limit: 1500/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 1223 Accepted Submission(s): 694Problem DescriptionElves are v原创 2016-05-03 22:24:55 · 3393 阅读 · 0 评论 -
poj 2559 Largest Rectangle in a Histogram(单调栈)
Largest Rectangle in a HistogramTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 18691 Accepted: 6005DescriptionA histogram is a polygon composed of a se原创 2016-05-28 14:21:09 · 490 阅读 · 0 评论 -
hdu 5386 Cover(暴搞+队列)
CoverTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1721 Accepted Submission(s): 602Special JudgeProblem DescriptionYou have原创 2016-05-28 14:28:12 · 387 阅读 · 0 评论 -
hdu 5381 The sum of gcd(线段树)
The sum of gcdTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1056 Accepted Submission(s): 465Problem DescriptionYou have an原创 2016-05-28 14:33:09 · 470 阅读 · 0 评论 -
CSU 1515: Sequence(莫队算法)
DescriptionGive you a sequence consisted of n numbers. You are required to answer how many pairs of numbers (ai, aj) satisfy that | ai - aj | = 1 and L ≤ i InputThe input consists of原创 2016-04-20 20:37:45 · 347 阅读 · 0 评论 -
codeforces 86D. Powerful array(莫队算法)
An array of positive integers a1, a2, ..., an is given. Let us consider its arbitrary subarray al, al + 1..., ar, where 1 ≤ l ≤ r ≤ n. For every positive integer s denote by Ks the number of o原创 2016-04-20 20:35:27 · 2355 阅读 · 0 评论 -
bzoj 2038: [2009国家集训队]小Z的袜子(hose)(莫队算法)
Description作为一个生活散漫的人,小Z每天早上都要耗费很久从一堆五颜六色的袜子中找出一双来穿。终于有一天,小Z再也无法忍受这恼人的找袜子过程,于是他决定听天由命……具体来说,小Z把这N只袜子从1到N编号,然后从编号L到R(L 尽管小Z并不在意两只袜子是不是完整的一双,甚至不在意两只袜子是否一左一右,他却很在意袜子的颜色,毕竟穿两只不同色的袜子会很尴尬。你的任务便是告诉小Z原创 2016-04-20 20:32:25 · 1296 阅读 · 0 评论 -
bzoj 1878: [SDOI2009]HH的项链(莫队算法)
DescriptionHH有一串由各种漂亮的贝壳组成的项链。HH相信不同的贝壳会带来好运,所以每次散步 完后,他都会随意取出一段贝壳,思考它们所表达的含义。HH不断地收集新的贝壳,因此, 他的项链变得越来越长。有一天,他突然提出了一个问题:某一段贝壳中,包含了多少种不同 的贝壳?这个问题很难回答。。。因为项链实在是太长了。于是,他只好求助睿智的你,来解 决这个问题。Input第原创 2016-04-20 20:30:30 · 1274 阅读 · 0 评论 -
hdu 4638 Group(莫队算法)
Problem DescriptionThere 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原创 2016-04-20 20:26:18 · 1587 阅读 · 1 评论 -
poj 2299 Ultra-QuickSort(求逆序对)
DescriptionIn this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence elements until the seque原创 2016-04-10 20:46:27 · 423 阅读 · 0 评论 -
poj 1804 Brainman(求逆序对)
DescriptionBackground Raymond Babbitt drives his brother Charlie mad. Recently Raymond counted 246 toothpicks spilled all over the floor in an instant just by glancing at them. And he can even c原创 2016-04-10 20:45:16 · 920 阅读 · 0 评论 -
hdu 5790 Prefix(字典树+主席树)
Problem DescriptionAlice gets N strings. Now she has Q questions to ask you. For each question, she wanna know how many different prefix strings between Lth and Rth strings. It's so easy right? So原创 2016-08-03 16:52:13 · 1000 阅读 · 1 评论