摘要:
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=610View Code 1 #include <cmath> 2 #include <cstdio> 3 #include <cstdlib> 4 #include <iostream> 5 #include <cstring> 6 #include <string> 7 #include <algorithm> 8 #include <queue> 9 #include 阅读全文
摘要:
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1698线段树水题View Code 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 using namespace std; 5 #define L(x)(x<<1) 6 #define R(x)(x<<1|1) 7 #define MID(x,y) ((x+y)>>1) 8 const int MAX=100005; 9 struct Tnode 阅读全文
摘要:
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1754存四个变量,两个边界一个sum存其成绩,max存这段的最值。在更新成绩时 父节点的max要同时更新。View Code 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 using namespace std; 5 #define L(x)(x<<1) 6 #define R(x)(x<<1|1) 7 #define MID(x,y) ((x+y)> 阅读全文
摘要:
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1166View Code 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 using namespace std; 5 #define L(x)(x<<1) 6 #define R(x)(x<<1|1) 7 #define MID(x,y) ((x+y)>>1) 8 const int MAX=50010; 9 struct Tnode{10 in 阅读全文
摘要:
题目链接:http://poj.org/problem?id=3468以前看过线段树,不过没看明白,也没做过这类题;这次一定要搞懂!!!再次看了两天的线段树,开始有点明白了,多谢媛神博客的支持。View Code 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 using namespace std; 5 #define L(x) (x<<1) 6 #define R(x) (x<<1|1) 7 #define MID(x,y) ((x+y)>&g 阅读全文