![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
线段树
HEU_xueyan
这个作者很懒,什么都没留下…
展开
-
HDU/HDOJ----1754 I Hate It
线段树模板题,求区间最大值。#include #include using namespace std;const int N = 200005;const int inf = 0;int seg[4*N],M;int max(int a,int b) { return a>b?a:b; }void segtree_build(int n){ int lv,i;原创 2012-06-04 10:58:41 · 438 阅读 · 0 评论 -
HDU/HDOJ----1166 敌兵布阵
线段树模板题,求区间和。在figo的指导下学习了据说是非递归火星版线段树,写了一下,感觉还可以,觉得跟下午看的张昆玮版的微像啊,用杭电1166测试一下,1A,在此感谢一下figo的指导。#include #include #include using namespace std;const int N = 50005;const int inf = 0;int seg[4原创 2012-06-04 10:51:31 · 370 阅读 · 0 评论 -
PKU/POJ----2886 Who Gets the Most Candies?
刚学会的常规版的线段树,单点更新。不知道为什么预处理因子和就超时,在线算就A,求大牛指点。#include #include #include #define lson l,mid,rt<<1#define rson mid+1,r,rt<<1^1using namespace std;const int N = 500005;struct People{ char原创 2012-06-02 20:10:49 · 286 阅读 · 0 评论 -
HDU/HDOJ----4302 Holedox Eating
多校第一场比较水的一道题,用线段树查找离要求点最近的目标。当时很快就有思路了,但是一直想拿ZKW版线段树写,由于没有完全掌握其精髓,当场没有做出来,赛后用常规版写的,而且写的比较丑陋……#include #include #include #define lson l,mid,rt<<1#define rson mid+1,r,rt<<1^1#define ll long long原创 2012-07-21 14:52:11 · 389 阅读 · 0 评论 -
HDU/HDOJ----4252 A Famous City
多校热身赛的一道比较水的题,一般都是用桟做的,我YY的线段树+二分,勉强也能跑过,但是调的时候还是调的比较费事的。#include #include #include #include #define N 100005#define inf 2e9using namespace std;int hight[N],tmp[N],build[N],last[N],num;原创 2012-07-24 14:52:09 · 427 阅读 · 0 评论