线段树1

· · 个人记录

define node {
  info;
  tag;
  void addtag() {}
}

push_down():
  add tag to lson and rson
  update lson and rson
  tag[father] = null

push_up():
  merge lson and rson and assign to tree[father]

update:
  if ql <= l && r <= qr:
     add tag
     update tree[cur]
  push_down()
  leftson and rightson
  push_up()

 query:
   if ql <= l && r<= qr
     return query
   push_down()
   return query of leftson and right son

扫描线