![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
线段树
星天93
很多烦恼是我们凭空虚构的,而我们却把它当做真实去承受。
展开
-
hdu1166之线段树
基础线段树模版,但是蛮经典的 #include#include#include#include#include#include#include#include#include#define INF 99999999using namespace std;const int MAX=50000+10;int sum[MAX<<2];//sum表示某个节点的区间和原创 2013-04-23 20:17:16 · 718 阅读 · 0 评论 -
hdu1540之线段树单点更新+区间合并
Tunnel WarfareTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3318 Accepted Submission(s): 1280Problem DescriptionDuring the原创 2013-09-12 22:18:48 · 3751 阅读 · 1 评论 -
hdu1264之线段树+扫描线
线段树原创 2013-07-30 21:16:35 · 1804 阅读 · 0 评论 -
hdu1828线段树+扫描线
http://acm.hdu.edu.cn/showproblem.php?pid=1828(矩形求周长类似矩形合并求面积,只是多了需要统计竖边的个数,对于每次求到的下底边长还要增加目前底边与下一条底边之间的竖边总长)1,n个矩形有2*n条线段,按从小到大排列,如上图得到的线段顺序2:开始扫描第一条线段,得到总底边长sum为a这部分,得到竖边个数segnum=2,(每增加一原创 2013-05-15 18:08:03 · 2832 阅读 · 2 评论 -
hdu4521之线段树单点更新
http://acm.hdu.edu.cn/showproblem.php?pid=4521#include#include#include#include#include#include#include#include#include#define INF 99999999using namespace std;const int MAX=100000+10;原创 2013-05-28 13:46:53 · 1003 阅读 · 0 评论 -
poj2481之线段树单点更新
CowsTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 9813 Accepted: 3214DescriptionFarmer John's cows have discovered that the clover growing along the ridge of the hill (which we c原创 2013-05-28 09:04:32 · 1305 阅读 · 0 评论 -
poj3667线段树区间合并
/*本题是线段树区间合并所谓区间合并我理解为父节点的某些值是由左孩子和右孩子的某些值合并而得到的对这题,父节点最大连续可用区间可能是由左孩子最大可用右区间和右孩子的最大可用左区间合并得到的 */#include#include#include#include#include#include#include#include#include#define INF 99999原创 2013-05-08 17:04:21 · 1242 阅读 · 0 评论 -
hdu4288之线段树单点更新
Problem 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 adven原创 2013-05-21 16:56:08 · 922 阅读 · 0 评论 -
hdu2886之线段树单点更新
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-05-19 20:36:39 · 801 阅读 · 0 评论 -
poj3225
Online JudgeProblem SetAuthorsOnline ContestsUserWeb BoardHome PageF.A.QsStatistical ChartsProblemsSubmit ProblemOnline StatusProb.ID:RegisterUpdate your infoAu原创 2013-05-04 21:52:33 · 2557 阅读 · 1 评论 -
poj2828之线段树单点更新
#include#include#include#include#include#include#include#include#include#define INF 99999999using namespace std;const int MAX=200000+10;int sum[MAX<<2];//表示区间内含有空位的个数int s[MAX][2];//记录刚开原创 2013-05-15 21:37:19 · 764 阅读 · 0 评论 -
hdu1542线段树+离散化+扫描线详解
用struct tree{double l,r,h;int d;tree(){}tree(double x1,double x2,double y,int c):l(x1),r(x2),h(y),d(c){}bool operator return h}}s[MAX];s表示一条线段,分别有线段的左右端点l,r,线段的高h,线段是矩形的上底边还是还是下底边d原创 2013-05-14 21:15:08 · 6672 阅读 · 4 评论 -
poj2528之线段树+离散化
#include#include#include#include#include#include#include#include#include#define INF 99999999using namespace std;//类似于在一个块上涂颜色,问最后能看到几种颜色const int MAX=10000+10;int hash[MAX*4];//离散化后的数组,所原创 2013-04-28 19:07:33 · 760 阅读 · 0 评论 -
poj3468之线段树
#include#include#include#include#include#include#include#include#include#define INF 99999999using namespace std;const int MAX=100000+10;__int64 sum[MAX<<2],mark[MAX<<2];//sum表示区间和,mark表示父原创 2013-04-25 20:32:13 · 1599 阅读 · 0 评论 -
hdu1698之线段树
详解请看代码注释 #include#include#include#include#include#include#include#include#include#define INF 99999999using namespace std;const int MAX=100000+10;//sum表示区间left~right的和,mark表示区间的是否已经更新(原创 2013-04-24 22:32:48 · 842 阅读 · 0 评论 -
hdu1394之线段树详解
详细思路转载一位大神:http://wenku.baidu.com/view/6e02b7492e3f5727a5e9623f.html感觉这题好经典,喜欢在代码中注释而不是单纯的说思路,所以代码中详细注释了自己的理解,相信能更好的理解思路和代码 #include#include#include#include#include#include#include#includ原创 2013-04-24 20:07:39 · 1016 阅读 · 0 评论 -
hdu1754之线段树
代码中详细注释 #include#include#include#include#include#include#include#include#include#define INF 99999999using namespace std;const int MAX=200000+10;int sum[MAX<<2];//sum表示第i个节点表示的区间的最大值原创 2013-04-23 20:51:30 · 735 阅读 · 0 评论 -
poj1436之线段树成段更新
Language:DefaultHorizontally Visible SegmentsTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 2925 Accepted: 1105DescriptionThere is a number of di原创 2013-05-29 19:50:14 · 3252 阅读 · 6 评论