In 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 consecutive metallic sticks which are of the same length. (图片走丢了,真不好意思,要不我补一张?) (对就是这张图)Now Pudge wants to do some opera…
题意  给出一段初始化全为1的区间  后面可以一段一段更改成 1 或 2 或3 问最后整段区间的和是多少 思路:标准线段树区间和模版题 #include<cstdio> #include<algorithm> #include<set> #include<vector> #include<cstring> #include<iostream> using namespace std; ; struct Node{ int l,r,su…
这就是很简单的基本的线段树的基本操作,区间修改,区间查询,对区间内部信息打上laze标记,然后维护即可. 我自己做的时候太傻逼了...把区间修改写错了,对给定区间进行修改的时候,mid取的是节点的左右的中间值,而不是更新区间的中间值(太菜了). #include<iostream> #include<stdio.h> #include<string.h> #include<algorithm> using namespace std; ; struct no…
#include <cstdio> #include <cstdlib> #include <cmath> #include <map> #include <set> #include <queue> #include <stack> #include <vector> #include <sstream> #include <string> #include <cstring&g…
区间修改&区间查询问题 [引言]信息学奥赛中常见有区间操作问题,这种类型的题目一般数据规模极大,无法用简单的模拟通过,因此本篇论文将讨论关于可以实现区间修改和区间查询的一部分算法的优越与否. [关键词]区间修改.区间查询.线段树.树状数组.分块 [例题] 题目描述: 如题,已知一个数列,你需要进行下面两种操作: 1.将某区间每一个数加上x 2.求出某区间每一个数的和 输入格式: 第一行包含两个整数N.M,分别表示该数列数字的个数和操作的总个数. 第二行包含N个用空格分隔的整数,其中第i个数字表示…
一开始这条链子全都是1 #include<stdio.h> #include<string.h> #include<algorithm> #include<math.h> #include<map> using namespace std; ///线段树 区间更新 #define MAX 100050 struct node { int left; int right; int mark; int total; }; node tree[MAX*…
Just a Hook Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 24474    Accepted Submission(s): 12194 Problem Description In the game of DotA, Pudge’s meat hook is actually the most horrible thing…
GSS2 - Can you answer these queries II #tree Being a completist and a simplist, kid Yang Zhe cannot solve but get Wrong Answer from most of the OI problems. And he refuse to write two program of same kind at all. So he always failes in contests. When…
BGSHOOT - Shoot and kill no tags  The problem is about Mr.BG who is a great hunter. Today he has gone to a dense forest for hunting and killing animals. Sadly, he has only one bullet in his gun. He wants to kill as many animals as possible with only…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1698 区间更新重点在于懒惰标记. 当你更新的区间就是整个区间的时候,直接sum[rt] = c*(r-l+1);col[rt] = c:后面的子区间就不管了,当你下次更新某一个区间的时候,把col[rt]从顶往下推(也没有推到底),推到合适的位置,刚好这个位置是我要更新的区间的子区间(可能被横跨了)就停下来. 在这里感谢网上的大牛,感谢杰哥,彬哥.我才能AC. Just a Hook Time Li…