随笔分类 -  线段树&树状数组

MUTC 3 A - Flowers 树状数组
摘要:FlowersTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1829Accepted Submission(s): 901Problem DescriptionAs is known to all, the blooming time and duration varies between different kinds of flowers. Now there is a garden planted full of flowers. Th 阅读全文

posted @ 2013-06-16 13:48 电子幼体 阅读(155) 评论(0) 推荐(0)

Hdu 1542 Atlantis 线段树 求矩形面积并
摘要:AtlantisTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4691Accepted Submission(s): 2095Problem DescriptionThere are several ancient Greek texts that contain descriptions of the fabled island Atlantis. Some of these texts even include maps of parts 阅读全文

posted @ 2013-05-16 14:43 电子幼体 阅读(209) 评论(0) 推荐(0)

Poj 3667 Hotel 线段树 区间合并
摘要:HotelTime Limit:3000MSMemory Limit:65536KTotal Submissions:8968Accepted:3804DescriptionThe 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, has named the Bullmoose Hotel 阅读全文

posted @ 2013-05-16 09:58 电子幼体 阅读(217) 评论(0) 推荐(0)

UVa 11992 - Fast Matrix Operations 成段更新,求最值与和
摘要:Problem FFast Matrix OperationsThere is a matrix containing at most 106elements divided into r rows and c columns. Each element has a location (x,y) where 10)2 x1 y1 x2 y2 vSet each element (x,y) in submatrix (x1,y1,x2,y2) to v3 x1 y1 x2 y2Output the summation, min value and max value of submatrix ( 阅读全文

posted @ 2013-05-14 18:26 电子幼体 阅读(161) 评论(0) 推荐(0)

UVa 12299 - RMQ with Shifts 线段树 单点更新
摘要:RMQ with ShiftsIn the traditional RMQ (Range Minimum Query) problem, we have a static arrayA. Then for each query(L,R)(LR), we report the minimum value amongA[L],A[L+ 1], ...,A[R]. Note that the indices start from 1, i.e. the left-most element isA[1].In this problem, the arrayAis no longer static: w 阅读全文

posted @ 2013-05-14 15:32 电子幼体 阅读(179) 评论(0) 推荐(0)

Poj 2528 Mayor's posters 线段树 离散化 成段更新
摘要:Mayor's postersTime Limit:1000MSMemory Limit:65536KTotal Submissions:32605Accepted:9469DescriptionThe 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 has finally 阅读全文

posted @ 2013-05-13 15:59 电子幼体 阅读(106) 评论(0) 推荐(0)

hdu 2795 Billboard 线段树 单点更新
摘要:BillboardTime Limit: 20000/8000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6525Accepted Submission(s): 2957Problem 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 阅读全文

posted @ 2013-05-12 20:01 电子幼体 阅读(126) 评论(0) 推荐(0)

线段树模板
摘要:单点更新,区间求最值#include #include #include #include #include #define N 222222 using namespace std; int num[N]; struct Tree { int l; int r; int max; } tree[N*4]; void push_up(int root) { tree[root].max=max(tree[root=tree[root].r) return tree[root].max; int mid=(tree[root].l+... 阅读全文

posted @ 2013-05-12 19:03 电子幼体 阅读(195) 评论(0) 推荐(0)

[置顶] ⑨的线段树专题
摘要:单点更新最最基础的线段树,只更新叶子节点,然后把信息用PushUP(int r)这个函数更新上来。hdu1166 敌兵布阵线段树 hdu 1166 敌兵布阵 单点更新区间求和hdu1754 I Hate It线段树 hdu 1754 I Hate It 单点更新 区间求最值hdu1394 Minimum Inversion Numberhdu 1394 Minimum Inversion Number 线段树 逆序数hdu2795 Billboardhdu 2795 Billboard 线段树 单点更新UVa 12299 - RMQ with Shifts 线段树 单点更新poj2828Buy 阅读全文

posted @ 2013-05-12 17:33 电子幼体 阅读(188) 评论(0) 推荐(0)

NEFU 700 Car race game 树状数组
摘要:Car race gameTime Limit 1000msMemory Limit 65536Kdescription Bob is a game programming specialist. In his new car race game, there are some racers(n means the amount of racers (1 output For each data set in the input print on a separate line, on the standard output, the integer that represe... 阅读全文

posted @ 2013-05-05 20:21 电子幼体 阅读(200) 评论(0) 推荐(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): 6365Accepted Submission(s): 3875Problem DescriptionThe inversion number of a given number sequence a1, a2, ..., an is the number of pairs (ai, aj) that satisfy i < j and ai 阅读全文

posted @ 2013-04-19 18:19 电子幼体 阅读(163) 评论(0) 推荐(0)

线段树 poj 3468 A Simple Problem with Integers 区间add更新
摘要:A Simple Problem with IntegersTime Limit:5000MSMemory Limit:131072KTotal Submissions:41899Accepted:12169Case Time Limit:2000MSDescriptionYou haveNintegers,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 interv 阅读全文

posted @ 2013-04-18 16:42 电子幼体 阅读(165) 评论(0) 推荐(0)

线段树 1698 Just a Hook 区间set更新
摘要:Just a HookTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 11297Accepted Submission(s): 5591Problem 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 consecu 阅读全文

posted @ 2013-04-18 16:41 电子幼体 阅读(123) 评论(0) 推荐(0)

线段树 hdu 1754 I Hate It 单点更新 区间求最值
摘要:I Hate ItTime Limit: 9000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 23163Accepted Submission(s): 9257Problem Description很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。Input本题目包含多组测试,请处理到文件结束。在每个 阅读全文

posted @ 2013-04-18 16:40 电子幼体 阅读(170) 评论(0) 推荐(0)

线段树 hdu 1166 敌兵布阵 单点更新区间求和
摘要:敌兵布阵Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 25659Accepted Submission(s): 11092Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人 阅读全文

posted @ 2013-04-18 16:39 电子幼体 阅读(141) 评论(0) 推荐(0)

导航