![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
树论
文章平均质量分 76
漩涡梦幻
有志者,事竞成,破釜沉舟,百二秦关终属楚 。 苦心人,天不负,卧薪尝胆,三千越甲可吞吴 。
展开
-
树状数组求最大值 (RMQ with Shifts)
代码:#include #include #include #include using namespace std;const int Max=200010;int RMQ[Max+10];int total[Max];int sum[35];int N,M,cnt;char ctr[35];int bit(int x){//每个下标管辖的范围 return原创 2015-08-19 22:07:13 · 800 阅读 · 0 评论 -
线段树模板(区间最小值优化 版) (RMQ with Shifts)
题意:#include #include #include #include #include using namespace std;const int maxn =100010;int RMQ[maxn<<2];int str[maxn];int N,M;char ctr[35];int total[35],cnt;int build(int first,int原创 2015-08-20 09:16:09 · 626 阅读 · 0 评论 -
POJ2155 Matrix二维线段树
一,题意:给你一个全为0的N * N的矩阵,对这个矩阵有两个操作(对于矩阵只有两个状态0,1)(1):“C x1,y1,x2,y2” 就是将左上角为x1,y1,右下角为x2,y2,的这个矩阵内的数字全部翻转。(2):“Q x1 y1” 输出a[x1][y1]的值。二,解析:该我主要应用令二位的树状数组,一个是行,一个是列。三,代码:#include#inclu原创 2015-08-20 11:53:46 · 675 阅读 · 0 评论