数据结构_线段树
SCUT_Pein
这个作者很懒,什么都没留下…
展开
-
UVA11297--Census(二维线段树)
DescriptionThis year, there have been many problems with population calculations, since in some cities, there are many emigrants, or the population growth is very high. Every year the ACM (for Assoc原创 2014-07-19 15:33:29 · 825 阅读 · 0 评论 -
UVA1232,LA4108,Skyline,线段树
The skyline of Singapore as viewed from the Marina Promenade (shown on the left) is one of the iconic scenes of Singapore. Country X would also like to create an iconic skyline, and it has put up a ca原创 2014-03-01 13:32:14 · 1347 阅读 · 0 评论 -
UVA12086 Potentionmeters 线段树
A potentiometer, or potmeter for short, is an electronic device with a variable electric resistance. It has two terminals and some kind of control mechanism (often a dial, a wheel or a slide) with whi原创 2014-02-28 19:37:54 · 1058 阅读 · 0 评论 -
LA 3938 线段树(区间合并)
After doing Ray a great favor to collect sticks for Ray, Poor Neal becomes very hungry. In return for Neal's help, Ray makes a great dinner for Neal. When it is time for dinner, Ray arranges all the d原创 2014-02-20 15:39:25 · 851 阅读 · 0 评论 -
UVA 11992 二维线段树
There is a matrix containing at most 106 elements divided into r rows and c columns. Each element has a location (x,y) where 11 x1 y1 x2 y2 vIncrement each element (x,y) in submatrix (x1,y1,x2,y2)原创 2014-02-21 13:39:16 · 768 阅读 · 0 评论 -
Pein线段树总结(陆续更新ing)
Pein线段树总结!原创 2013-08-08 09:21:32 · 1208 阅读 · 0 评论 -
POJ2991--Crane
DescriptionACM has bought a new crane (crane -- jeřáb) . The crane consists of n segments of various lengths, connected by flexible joints. The end of the i-th segment is joined to the beginning o原创 2013-08-04 00:22:09 · 796 阅读 · 0 评论 -
POJ2823--Sliding Window
DescriptionAn array of size n ≤ 106 is given to you. There is a sliding window of sizek which is moving from the very left of the array to the very right. You can only see thek numbers in the wi原创 2013-08-02 12:50:05 · 673 阅读 · 0 评论 -
POJ3368--Frequent values
DescriptionYou are given a sequence of n integers a1 , a2 , ... , an in non-decreasing order. In addition to that, you are given several queries consisting of indices i and j (1 ≤ i ≤ j ≤ n).原创 2013-07-18 10:35:39 · 629 阅读 · 0 评论 -
POJ3321--Apple Tree
DescriptionThere is an apple tree outside of kaka's house. Every autumn, a lot of apples will grow in the tree. Kaka likes apple very much, so he has been carefully nurturing the big apple tree.原创 2013-07-17 16:32:02 · 855 阅读 · 0 评论 -
LA4730,Kingdom 线段树+并查集
There were n cities in an ancient kingdom. In the beginning of the kingdom, all cities were isolated. Kings ordered their subjects to construct roads connecting cities. A lot of roads were built wit原创 2014-03-01 15:23:50 · 1342 阅读 · 0 评论 -
UVA 11235
You are given a sequence of n integers a1 , a2 , ... , an in non-decreasing order. In addition to that, you are given several queries consisting of indices i and j (1 ≤ i ≤ j ≤ n). For each query, d原创 2014-02-19 23:27:08 · 751 阅读 · 0 评论 -
HDU2871--Memory Control
Problem DescriptionMemory units are numbered from 1 up to N.A sequence of memory units is called a memory block. The memory control system we consider now has four kinds of operations:1. Rese原创 2013-04-24 15:40:39 · 1204 阅读 · 1 评论 -
GDCPC2009--H(线段树)
Westward JourneyOnline(Input File: h.in /Standard Output) “Westward Journey” is one of the most popular online gamesin China, which is developed and run by NIE. The game is based on the famousan原创 2014-04-12 18:38:29 · 666 阅读 · 0 评论 -
逃票的chanming(1)
Description 这是一个神奇的国度。 这个国度一共有N个城市组成,让我们将他们编号为1~N, 这一天,chanming带着他的第一个月的工资K元来到了城市1。他想到城市N去寻找宝藏。qinhang3想跟chanming一起去,但是chanming并不想带他(太大只,逃票太明显)。于是他对qinhang3说,这样吧,你帮我解决这个问题,我们就一起走,不然原创 2014-04-25 21:33:31 · 905 阅读 · 0 评论 -
counting--线段树
Description There are three operations in the axis, which are:1. Draw a segment in the axis between points a and b (a 2. Erase the one existing segment which was drawn before. Suppose th原创 2014-04-03 20:38:11 · 571 阅读 · 0 评论 -
SPOJ3267--D-query(离线线段树||在线主席树)
Given a sequence of n numbers a1, a2, ..., an and a number of d-queries. A d-query is a pair (i, j) (1 ≤ i ≤ j ≤ n). For each d-query (i, j), you have to return the number of distinct elements in th原创 2014-04-16 10:36:50 · 930 阅读 · 0 评论 -
2011珠海赛--Minimal Elements(线段树)
Description Given a partial order (P, <=). Every element pi of set P is a vector of three integers: (xi, yi, zi). Say pi <= pj iff xi <= xj and yi <= yj and zi<=zj. An element pi is called a minim原创 2014-03-30 22:21:36 · 1411 阅读 · 3 评论 -
POJ2761--Feed the dogs
DescriptionWind loves pretty dogs very much, and she has n pet dogs. So Jiajia has to feed the dogs every day for Wind. Jiajia loves Wind, but not the dogs, so Jiajia use a special way to feed the d原创 2013-11-14 21:32:13 · 1126 阅读 · 0 评论 -
UVA11402--Ahoy, Pirates!--线段树
In the ancient pirate ages, the PirateLand was divided into two teams of pirates, namely, the Buccaneer and the Barbary pirates. Each pirate’s team was not fixed, sometimes the opponent pirates attack原创 2014-03-08 14:28:42 · 966 阅读 · 0 评论 -
UVA12299--线段树
In the traditional RMQ (Range Minimum Query) problem, we have a static array A. Then for each query (L, R) (LR), we report the minimum value among A[L],A[L + 1], ..., A[R]. Note that the indices原创 2014-03-04 22:22:48 · 605 阅读 · 0 评论 -
UVA1513--Movie collection--线段树
Mr. K. I. has a very big movie collection. He has organized his collection in a big stack. Whenever he wants to watch one of the movies, he locates the movie in this stack and removes it carefully,原创 2014-03-01 21:08:36 · 1021 阅读 · 0 评论 -
Coder
Description In mathematics and computer science, an algorithm describes a set of procedures or instructions that define a procedure. The term has become increasing popular since the advent of che原创 2013-05-17 15:41:46 · 677 阅读 · 0 评论 -
HDU3308--LCIS
Problem DescriptionGiven n integers.You have two operations:U A B: replace the Ath number by B. (index counting from 0)Q A B: output the length of the longest consecutive increasing subsequenc原创 2013-04-17 22:42:24 · 799 阅读 · 0 评论 -
POJ3667--Hotel
DescriptionThe cows are journeying north to Thunder Bay in Canada to gain cultural enrichment and enjoy a vacation on the sunny shores of Lake Superior. Bessie, ever the competent travel agent,原创 2013-04-17 20:01:53 · 706 阅读 · 0 评论 -
POJ3277--City Horizon
DescriptionFarmer John has taken his cows on a trip to the city! As the sun sets, the cows gaze at the city horizon and observe the beautiful silhouettes formed by the rectangular buildings.The原创 2013-04-23 16:29:43 · 756 阅读 · 0 评论 -
POJ3225--Help with Intervals
DescriptionLogLoader, Inc. is a company specialized in providing products for analyzing logs. While Ikki is working on graduation design, he is also engaged in an internship at LogLoader. Among原创 2013-04-16 22:10:14 · 790 阅读 · 0 评论 -
HDU3397--Sequence operation
Problem Descriptionlxhgww got a sequence contains n characters which are all '0's or '1's.We have five operations here:Change operations:0 a b change all characters into '0's in [a , b]1 a b原创 2013-04-21 22:51:06 · 673 阅读 · 0 评论 -
POJ2750--Potted Flower--线段树+DP
DescriptionThe little cat takes over the management of a new park. There is a large circular statue in the center of the park, surrounded by N pots of flowers. Each potted flower will be assigned to原创 2013-03-31 20:15:29 · 902 阅读 · 0 评论 -
POJ2886--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原创 2013-03-31 18:44:19 · 767 阅读 · 0 评论 -
POJ2777--Count Color
DescriptionChosen Problem Solving and Program design as an optional course, you are required to solve all kinds of problems. Here, we get a new problem.There is a very long board with length L原创 2013-03-30 18:43:42 · 710 阅读 · 0 评论 -
Sum up--RMQ--线段树
DescriptionGiven an array a[] with N elements,you areasked to perform several operations,each of them is one of the two kinds:1. a[i]=j;2. calculate sum(a[x]) whereiInput原创 2013-03-12 15:56:44 · 667 阅读 · 0 评论 -
POJ3264--点更新的线段树--RMQ--Balanced Lineup
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.原创 2013-03-08 13:43:32 · 556 阅读 · 0 评论 -
HDU1828--Picture
Problem DescriptionA 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原创 2013-04-19 22:28:06 · 748 阅读 · 0 评论 -
HDU3265--Posters
Problem DescriptionTed has a new house with a huge window. In this big summer, Ted decides to decorate the window with some posters to prevent the glare outside. All things that Ted can find are rec原创 2013-04-20 21:56:57 · 710 阅读 · 0 评论 -
POJ2482--Stars in Your Window
DescriptionFleeting time does not blur my memory of you. Can it really be 4 years since I first saw you? I still remember, vividly, on the beautiful Zhuhai Campus, 4 years ago, from the moment I saw原创 2013-04-25 22:15:08 · 774 阅读 · 0 评论 -
HDU1698--Just a hook--线段树区间更新
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 same lengt原创 2013-02-04 15:04:57 · 454 阅读 · 0 评论 -
HDU1394--Minimum Inversion Number
Problem DescriptionThe inversion number of a given number sequence a1, a2, ..., an is the number of pairs (ai, aj) that satisfy i aj.For a given sequence of numbers a1, a2, ..., an, if we move原创 2013-04-15 16:34:24 · 692 阅读 · 0 评论 -
HDU1166--敌兵布阵
Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。原创 2013-04-15 12:46:42 · 677 阅读 · 0 评论 -
POJ2528--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 council原创 2013-03-29 22:53:46 · 859 阅读 · 0 评论