线段树
hncu__lz
既然坚持了这么久,就要坚持到最后~
展开
-
hdu3911(线段树,区间合并,延迟标记)
题意:就是给你一段由0和1组成的序列,然后有两种操作:0 a b就是问从a到b最长的连续的1的长度为多少,1 a b就是把从a到b的数据是一的更新为0,是零的更新为1.思路:用一个结构体,lone表示从最左边数连续1的长度,lzero表示从左边数连续0的长度,rone表示从右边数连续1的长度,rzero表示从右边数连续0的长度,tmax0表示连续最长的0的个数,tmax1表示连续最长的1的个数,fl原创 2016-05-28 20:40:25 · 746 阅读 · 0 评论 -
hdu 1541 Stars (线段树)
Problem DescriptionAstronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star be an amount of the stars tha原创 2016-12-22 15:59:44 · 251 阅读 · 0 评论 -
hdu 1540 Tunnel Warfare(区间合并)
Problem DescriptionDuring the War of Resistance Against Japan, tunnel warfare was carried out extensively in the vast areas of north China Plain. Generally speaking, villages connected by tunnels la原创 2016-12-22 10:09:15 · 189 阅读 · 0 评论 -
poj 2182 Lost Cows (单点线段树)
DescriptionN (2 <= N <= 8,000) cows have unique brands in the range 1..N. In a spectacular display of poor judgment, they visited the neighborhood 'watering hole' and drank a few too many beers be原创 2016-11-01 20:31:09 · 153 阅读 · 0 评论 -
poj 2528 Mayor's posters(线段树+离散化)
DescriptionThe citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral posters at all places at their whim. The city counci原创 2016-11-13 17:35:52 · 266 阅读 · 0 评论 -
poj 3468 A Simple Problem with Integers(线段树+延迟标记)
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-11-13 15:52:42 · 219 阅读 · 0 评论 -
poj 2886 Who Gets the Most Candies?(线段树)
DescriptionN children are sitting in a circle to play a game.The children are numbered from 1 to N in clockwise order. Each of them has a card with a non-zero integer on it in his/her hand. The原创 2016-11-11 12:01:21 · 231 阅读 · 0 评论 -
hdu 1754 I Hate It (线段树)
Problem Description很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。 Input本题目包含多组测试,请处理到文件结束。在每个测试的第一行,有两个正整数 N原创 2016-10-30 21:07:41 · 146 阅读 · 0 评论 -
hdu 3564 Another LIS(线段树+lis)
Problem DescriptionThere is a sequence firstly empty. We begin to add number from 1 to N to the sequence, and every time we just add a single number to the sequence at a specific position. Now, we w原创 2016-11-11 11:01:55 · 243 阅读 · 0 评论 -
HDU 4348 To the moon (可持久化线段树+更新)
Problem Description Background To The Moon is a independent game released in November 2011, it is a role-playing adventure game powered by RPG Maker. The premise of To The Moon is based around a tec原创 2016-08-05 09:03:13 · 520 阅读 · 1 评论 -
*hdu 2665 (可持久化线段树)
Problem Description Give you a sequence and ask you the kth big number of a inteval.Input The first line is the number of the test cases. For each test case, the first line contain two integer n an原创 2016-08-04 06:28:12 · 255 阅读 · 0 评论 -
hdu 1394 Minimum Inversion Number (线段树)
Problem Description The inversion number of a given number sequence a1, a2, …, an is the number of pairs (ai, aj) that satisfy i < j and ai > aj.For a given sequence of numbers a1, a2, …, an, if we mo原创 2016-07-30 14:38:54 · 182 阅读 · 0 评论 -
hdu1698 Just a Hook (线段树,区间更新)
Problem Description In 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 same原创 2016-07-26 15:23:15 · 1865 阅读 · 0 评论 -
HDU1556(线段树)
代码:#include<stdio.h>#define maxn 1000005int nn;struct node{ int l,r,sum;}str[maxn];void build(int l,int r,int n){ str[n].l=l; str[n].r=r; str[n].sum=0; if(l==r) retur原创 2016-05-26 21:02:26 · 372 阅读 · 0 评论 -
hdu1166(线段数,节点更新)
Problem Description C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。原创 2016-05-27 15:11:46 · 262 阅读 · 0 评论 -
hdu2795(线段树,节点更新)
Problem Description At 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 announcements a原创 2016-05-27 20:18:34 · 216 阅读 · 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原创 2017-01-03 10:06:24 · 195 阅读 · 0 评论