摘要:
/* 带点更新(累加),求部分线段和 */ /*(1) Add i j,i和j为正整数,表示第i个营地增加j个人(j不超过30) (2)Sub i j ,i和j为正整数,表示第i个营地减少j个人(j不超过30); (3)Query i j ,i和j为正整数,i #include #define maxn 50010 typedef struct node{ int sum ; ... 阅读全文
摘要:
HDU 1166 敌兵布阵(单点更新,区域查询求和的线段树模板) http://acm.hdu.edu.cn/showproblem.php?pid=1166////////////////////////////////////////////////敌兵布阵Time Limit: 2000/10 阅读全文
摘要:
HDU 1754 I Hate Ithttp://acm.hdu.edu.cn/showproblem.php?pid=1754//////////////////注意线段树 的大小要比 需要使用线段树的数据的个数 大个3到4倍 /////////////////////////////////// 阅读全文
摘要:
HDU 1698 ( 延迟标记,区间更新(赋值)求和 ) Just a Hook题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=1698////////////////////////////////////注意 : lazy思想的简单应用,所谓的laz 阅读全文
摘要:
/* 延迟标记,区间更新(赋值)求总和 , HDU1698 */ #include #include #include #include using namespace std ; #define maxn 2000000 struct node { int le ; int ri ; int sum , flag ; }; node tree[maxn]... 阅读全文
摘要:
/* 单点更新,区间查询最值 *//* 注意线段树的大小要比需要使用线段树的数据的个数 大3到4倍 */ #include #include #include #include using namespace std ; #define maxn 4000001 struct node { int le , ri ; int num ; }; node tree... 阅读全文