数据结构_线段树
SCUT_Pein
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
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 · 1337 阅读 · 1 评论 -
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 · 968 阅读 · 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 · 720 阅读 · 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 · 784 阅读 · 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 · 906 阅读 · 0 评论 -
Pein线段树总结(陆续更新ing)
Pein线段树总结!原创 2013-08-08 09:21:32 · 1360 阅读 · 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 · 889 阅读 · 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 · 941 阅读 · 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 · 1175 阅读 · 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 · 1479 阅读 · 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 · 1494 阅读 · 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 · 861 阅读 · 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 · 763 阅读 · 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 · 1183 阅读 · 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 · 725 阅读 · 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 · 1079 阅读 · 0 评论 -
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 · 1269 阅读 · 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 · 1543 阅读 · 3 评论 -
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 · 1042 阅读 · 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 · 660 阅读 · 0 评论 -
逃票的chanming(1)
Description 这是一个神奇的国度。 这个国度一共有N个城市组成,让我们将他们编号为1~N, 这一天,chanming带着他的第一个月的工资K元来到了城市1。他想到城市N去寻找宝藏。qinhang3想跟chanming一起去,但是chanming并不想带他(太大只,逃票太明显)。于是他对qinhang3说,这样吧,你帮我解决这个问题,我们就一起走,不然原创 2014-04-25 21:33:31 · 1025 阅读 · 0 评论 -
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 · 775 阅读 · 0 评论 -
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 · 935 阅读 · 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 · 905 阅读 · 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 · 665 阅读 · 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 · 770 阅读 · 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 · 790 阅读 · 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 · 868 阅读 · 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 · 1013 阅读 · 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 · 748 阅读 · 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 · 913 阅读 · 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 · 844 阅读 · 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 · 846 阅读 · 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 · 840 阅读 · 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 · 812 阅读 · 0 评论 -
HDU1754--点更新的线段树
Description很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。Input本题目包含多组测试,请处理到文件结束。在每个测试的第一行,有两个正整数 N 和 M ( 0,原创 2013-01-31 22:22:50 · 632 阅读 · 0 评论 -
HDU2795--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 announcements原创 2013-04-15 19:31:22 · 699 阅读 · 0 评论 -
POJ2828--Buy Tickets
DescriptionRailway tickets were difficult to buy around the Lunar New Year in China, so we must get up early and join a long queue…The Lunar New Year was approaching, but unluckily the Little Ca原创 2013-03-30 15:52:59 · 768 阅读 · 0 评论 -
POJ3468--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 i原创 2013-04-16 15:21:39 · 810 阅读 · 0 评论 -
HDU1542--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, the原创 2013-04-19 16:20:23 · 897 阅读 · 0 评论
分享