zrq495
www.zrq495.com
摘要: 线段树。代码如下: 1 #include<iostream> 2 #include<cstdio> 3 #define max 2000002 4 5 using namespace std; 6 7 typedef struct 8 { 9 int l, r;10 int val;11 }node;12 13 node t[4*max];14 15 void build(int l, int r, int rt)16 {17 t[rt].l=l;18 t[rt].r=r;19 if (l == r)20 {21 scanf(... 阅读全文
posted @ 2012-08-09 21:15 zrq495 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 线段树。代码如下: 1 #include<iostream> 2 #include<cstring> 3 #include<cstdio> 4 #define max 50002 5 6 using namespace std; 7 8 typedef struct 9 {10 int l, r;11 int val;12 }node;13 14 node w[4*max];15 16 void pushup(int rt)17 {18 w[rt].val=w[rt<<1].val+w[rt<<1|1].val;19 }20 21 v 阅读全文
posted @ 2012-08-09 21:14 zrq495 阅读(171) 评论(0) 推荐(0) 编辑