水水的,心头暖暖的~~~其实线段树就像trie树,解题的关键都存在于结构域中View Code #include<stdio.h>#include<string.h>#define R(x) x<<1|1#define L(x) x<<1#define MID(x,y) (x+y)>>1#define max(a,b) a>b?a:bconst int MAX=200010;struct {int s,l,r;}node[3*MAX];int c[MAX];int get_val(){ int ret(0); char c; w Read More
posted @ 2011-08-30 18:04 Because Of You Views(190) Comments(0) Diggs(0) Edit
View Code //第一次做线段树,不怎么会,试着模仿别人的写法,修修改改//继续努力!!!//初始状态全为1,x,y,z代表把x->y区间改为z#include<stdio.h>#include<string.h>const int MAX=100010;#define L(x) x<<1#define R(x) x<<1|1#define MID(x,y) (x+y)>>1struct {int color,l,r;}node[3*MAX]; void treeinit(){ memset(node,0,sizeof(n Read More
posted @ 2011-08-30 13:26 Because Of You Views(204) Comments(0) Diggs(1) Edit