![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
线段树
lanxuan365
这个作者很懒,什么都没留下…
展开
-
HDU1823(二维线段树)
区间 查询+单点修改注意二维添加操作#include <iostream> #include <cstdio> #include <algorithm> using namespace std; const int MAXN=205; const int MAXM=1005; struct node { int l,r,max; }; struct tree { node sub[4原创 2015-08-15 16:29:40 · 347 阅读 · 0 评论 -
线段树求和,最大公约数
// // main.cpp // newday // // Created by 耿飞 on 15/8/14. // Copyright (c) 2015年 耿飞. All rights reserved. //#include <iostream> #include <cstdio> #include <algorithm> #include <cmath> #include <set>原创 2015-08-14 19:33:16 · 513 阅读 · 0 评论 -
线段树(区间修改,区间求和)
lzay标记,注意query和updata的时候都需要push,并且push的位置不同#include <iostream> #include <cstdio> #include <algorithm> using namespace std; const int MAXN=100005; struct node { int l,r; long long sum,tag; }s[4*原创 2015-08-15 17:36:09 · 1090 阅读 · 0 评论 -
二维线段树
二维线段树矩阵区间查询最大值 /* 矩阵求和预处理后O(1)就能算出来,不用线段树,除非有修改操作 */先第一维在第二维,注意建树有个顺序问题, 应该让第一维度的先建完然后再建第二个维度 具体看代码#include <iostream> #include <cstdio> #include <algorithm> using namespace std; const int MAXN=10原创 2015-08-15 11:05:51 · 595 阅读 · 0 评论