ACM 线段树
文章平均质量分 91
青山绿水之辈
奋斗青春年华
展开
-
hdu3999The order of a Tree (二叉排序树(BST))
Problem DescriptionAs we know,the shape of a binary search tree is greatly related to the order of keys we insert. To be precisely:1. insert a key k to a empty tree, then the tree become a tree wi原创 2013-08-19 17:55:40 · 1842 阅读 · 0 评论 -
hdu3577Fast Arrangement (线段树+离散化,记录最大值的变形)
Problem DescriptionChinese always have the railway tickets problem because of its' huge amount of passangers and stations. Now goverment need you to develop a new tickets query system.One train ca原创 2013-11-04 17:21:37 · 964 阅读 · 0 评论 -
hdu1541Stars (线段树,二维变一维)
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原创 2013-11-06 17:27:39 · 1007 阅读 · 0 评论 -
hdu4533约会安排 (线段树,段更新,与求最长连续升序子序列的题很类似)
Problem Description 寒假来了,又到了小明和女神们约会的季节。 小明虽为屌丝级码农,但非常活跃,女神们常常在小明网上的大段发言后热情回复“呵呵”,所以,小明的最爱就是和女神们约会。与此同时,也有很多基友找他开黑,由于数量实在过于巨大,怎么安排时间便成了小明的一大心事。 我们已知小明一共有T的空闲时间,期间会有很多女神或者基友来找小明。 作为一个操作系统曾经原创 2013-11-07 18:14:27 · 1152 阅读 · 0 评论 -
hdu3397Sequence operation(线段树,段异或,段覆盖,段查找)
lxhgww 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 change all character原创 2013-11-12 18:14:57 · 1344 阅读 · 0 评论 -
hrbust简单操作
Description有一个空集合,集合内部的元素是一个 pair 。五种操作:1、ADD新添一个元素 pair保证元素的A 都不相等Add A B 2、INC代表所有元素的A和X异或的结果在[L , R]范围内的元素的 B都要加上 C。注意:这个操作是瞬间的,后来新加入的元素是不会被这个操作作用。原创 2014-03-30 16:45:05 · 1361 阅读 · 0 评论 -
FZU2171 防守阵地 II (线段树)
Accept: 25 Submit: 98Time Limit: 3000 mSec Memory Limit : 32768 KB Problem Description部队中总共有N个士兵,每个士兵有各自的能力指数Xi,在一次演练中,指挥部确定了M个需要防守的地点,指挥部将选择M个士兵依次进入指定地点进行防守任务,获得的参考指数即为M个士兵的能力之和。随着时间的推移,指原创 2014-04-27 22:26:29 · 1069 阅读 · 0 评论 -
hdu4893Wow! Such Sequence! (线段树)
Problem DescriptionRecently, Doge got a funny birthday present from his new friend, Protein Tiger from St. Beeze College. No, not cactuses. It's a mysterious blackbox.After some research, Doge f原创 2014-07-29 17:30:09 · 1095 阅读 · 0 评论 -
HDU4973A simple simulation problem.(线段树,区间更新)
A simple simulation problem.Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 330 Accepted Submission(s): 132Problem DescriptionTh原创 2014-08-22 16:06:53 · 987 阅读 · 0 评论 -
建立平衡二叉树(AVL)
创立方法:先把n个数从小到大排序,然后用了二分法建立 平衡二叉树(AVL);如果不信的话可以用先序遍历或后序遍历来验证正确性。#include#include#include#includeusing namespace std;typedef struct nn{ int w; struct nn *lchilde,*rchilde;}tree,*Tree;原创 2013-08-22 00:16:34 · 3257 阅读 · 1 评论 -
HDU3564Another LIS(线段树,LIS升级)
Another LISTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1211 Accepted Submission(s): 424Problem DescriptionThere is a sequence原创 2014-09-15 23:45:47 · 1493 阅读 · 1 评论 -
HDU4027Can you answer these queries?(线段树区间和,坑)
Can you answer these queries?Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65768/65768 K (Java/Others)Total Submission(s): 8674 Accepted Submission(s): 1971Problem DescriptionA lot原创 2014-09-26 22:47:27 · 2180 阅读 · 1 评论 -
FZU2105 Digits Count(经典 线段树)
Digits CountTime Limit:10000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionGiven N integers A={A[0],A[1],...,A[N-1]}. Here we have some operati原创 2014-12-08 12:09:03 · 1310 阅读 · 0 评论 -
中南OJ1551: Longest Increasing Subsequence Again(分块+离散化线段树)
1551: Longest Increasing Subsequence AgainTime Limit: 2 Sec Memory Limit: 256 MBSubmit: 29 Solved: 15[Submit][Status][Web Board]DescriptionGive you a numeric sequence. If you can d原创 2015-03-28 22:27:34 · 1274 阅读 · 0 评论 -
BNU 49100超级线段树
超级线段树Time Limit: 5000msMemory Limit: 65536KB64-bit integer IO format: %lld Java class name: MainPrev Submit Status Statistics Discuss NextFont Size: + -Type:原创 2015-05-09 20:23:57 · 934 阅读 · 0 评论 -
XTU1238Segment Tree(线段树)解题思想必较经典
Segment TreeAccepted : 9 Submit : 123Time Limit : 9000 MS Memory Limit : 65536 KBSegment TreeProblem Description:A contest is not integrity without prob原创 2015-06-14 08:12:28 · 947 阅读 · 0 评论 -
HDU 5200 Trees(线段树 离线应用)经典
TreesTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1117 Accepted Submission(s): 353Problem DescriptionToday CodeFamer is going原创 2015-08-23 15:57:43 · 801 阅读 · 0 评论 -
CSU 1335: 高桥和低桥(扫描线) 13年省赛题
1335: 高桥和低桥Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 957 Solved: 279[Submit][Status][Web Board]Description有个脑筋急转弯是这样的:有距离很近的一高一低两座桥,两次洪水之后高桥被淹了两次,低桥却只被淹了一次,为什么?答案是:因为低桥太低了,第一次洪水退去之原创 2015-08-25 21:09:20 · 778 阅读 · 0 评论 -
hdu1540Tunnel 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原创 2013-11-02 17:11:00 · 1544 阅读 · 0 评论 -
poj2886Who 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-10-30 21:39:57 · 1757 阅读 · 0 评论 -
hdu4521小明系列问题——小明序列 (线段树+dp,求出不连续的最长升序子序列)
Problem Description 大家都知道小明最喜欢研究跟序列有关的问题了,可是也就因为这样,小明几乎已经玩遍各种序列问题了。可怜的小明苦苦地在各大网站上寻找着新的序列问题,可是找来找去都是自己早已研究过的序列。小明想既然找不到,那就自己来发明一个新的序列问题吧!小明想啊想,终于想出了一个新的序列问题,他欣喜若狂,因为是自己想出来的,于是将其新序列问题命名为“小明序列”。原创 2013-10-29 22:35:55 · 1044 阅读 · 0 评论 -
hdu1166敌兵布阵 (线段树)
Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。原创 2013-10-01 13:41:47 · 876 阅读 · 0 评论 -
hdu1754 I Hate It (线段树,求区间内的最大值)
Problem Description很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。Input本题目包含多组测试,请处理到文件结束。在每个测试的第一行,有两个正整数 N 和 M ( 0原创 2013-10-02 18:52:20 · 914 阅读 · 0 评论 -
hdu1698Just a Hook (线段树 成段更新,这题目真是坑,按题目意思开的数组还小)
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 same原创 2013-10-03 22:13:08 · 980 阅读 · 0 评论 -
hdu1199Color the Ball (线段树 段更新+离散化)
Problem DescriptionThere are infinite balls in a line (numbered 1 2 3 ....), and initially all of them are paint black. Now Jim use a brush paint the balls, every time give two integers a b and foll原创 2013-10-04 11:38:03 · 2464 阅读 · 5 评论 -
HDU4046Panda (线段树 点更新,段查寻)
Problem DescriptionWhen I wrote down this letter, you may have been on the airplane to U.S.We have known for 15 years, which has exceeded one-fifth of my whole life. I still remember the first t原创 2013-10-06 22:26:44 · 963 阅读 · 0 评论 -
hdu3074Multiply game(线段树 点更新,求段的积)
Problem DescriptionTired of playing computer games, alpc23 is planning to play a game on numbers. Because plus and subtraction is too easy for this gay, he wants to do some multiplication in a numbe原创 2013-10-06 19:04:46 · 1047 阅读 · 0 评论 -
hdu3911Black And White (线段树,段异或,段查寻)
Problem DescriptionThere are a bunch of stones on the beach; Stone color is white or black. Little Sheep has a magic brush, she can change the color of a continuous stone, black to white, white to b原创 2013-10-08 14:10:39 · 1176 阅读 · 0 评论 -
hdu3308LCIS(线段树,点更新,段查寻,查寻时一定要注意跨越时如何计算)
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-10-07 22:06:58 · 1067 阅读 · 0 评论 -
hdu4107 Gangster (线段树,段更新完后求数组内的值)
Problem DescriptionThere are two groups of gangsters fighting with each other. The first group stands in a line, but the other group has a magic gun that can shoot a range [a, b], and everyone in th原创 2013-10-12 22:06:28 · 1131 阅读 · 0 评论 -
hdu4614Vases and Flowers(线段树,段设置,更新时范围的右边值为变量)
Problem Description Alice is so popular that she can receive many flowers everyday. She has N vases numbered from 0 to N-1. When she receive some flowers, she will try to put them in the vases, one原创 2013-10-13 18:22:13 · 1880 阅读 · 0 评论 -
poj2777Count Color(线段树,段更新,段查询用map函数)
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-10-13 22:23:08 · 1849 阅读 · 1 评论 -
poj2528Mayor's posters(线段树+二分查找+离散化,查找用map函数记录是否重复)
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原创 2013-10-14 21:23:54 · 904 阅读 · 0 评论 -
poj3468A 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原创 2013-10-15 20:21:21 · 898 阅读 · 0 评论 -
poj2828Buy 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-10-25 15:25:05 · 856 阅读 · 0 评论 -
hdu1394Minimum 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-10-25 17:44:27 · 926 阅读 · 0 评论 -
poj2182Lost 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原创 2013-10-28 12:45:40 · 1132 阅读 · 0 评论 -
hdu2795Billboard (线段树,看作点更新)
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-10-23 21:05:39 · 796 阅读 · 0 评论 -
POJ 1389 Area of Simple Polygons(面积合并,线段树+离散化)
Area of Simple PolygonsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 3257 Accepted: 1678DescriptionThere are N, 1 <= N <= 1,000 rectangles in the 2-D原创 2015-07-19 22:25:44 · 1140 阅读 · 0 评论