写了3分之一的树剖板子,然后想调试,然后报错了,so,why?QMQ
#include<bits/stdc++.h>
#define rs id<<1|1
#define ls id<<1
using namespace std;
const int M=5e5+110;
int read(){
int sum=0,k=1;
char c=getchar();
while(c>'9'||c<'0'){if(c=='-')k=-1;c=getchar();}
while(c>='0'&&c<='9'){sum=sum*10+c-'0';c=getchar();}
return sum*k;
}
int head[M],chr=0;
struct w{int next,to;}e[M];
void add(int u,int v){e[++chr]={head[u],v};head[u]=chr;}
int size[M],fa[M],deep[M],son[M];
void dfs1(int u,int ft){
size[u]=1;
deep[u]=deep[ft]+1;
for(int i=head[u];i;i=e[i].next){
int v=e[i].to;
if(v==ft) continue;
fa[v]=u;
size[u]+=size[v];
if(size[v]>size[son[u]]) son[u]=v;
}
}
int tap[M],new_id[M],new_val[M],tree_val[M];
int cnt=0;
void dfs2(int u,int top){
new_id[++cnt]=u;
new_val[cnt]=tree_val[u];
tap[u]=top;
if(son[u]==0) return;
dfs2(son[u],top);
for(int i=head[u];i;i=e[i].next){
int v=e[i].to;
if(v==fa[u]||v==son[u]) continue;
dfs2(v,v);
}
}
struct tree_node{
int lz,rz,sum;
int lazy;
}t[M];
void build(int l,int r,int id){
t[id].lz=l;
t[id].rz=r;
if(l==r){
t[id].sum=new_id[l];
return ;
}
int mid=l+r>>1;
build(l,mid,ls);
build(mid+1,r,rs);
t[id].sum=t[ls].sum+t[rs].sum;
}
void update(){
t[ls].sum+=(t[ls].rz-t[ls].lz+1)*t[id].lazy;
t[rs].sum+=(t[rs].rz-t[rs].lz+1)*t[id].lazy;
t[ls].lazy+=t[id].lazy;
t[rs].lazy+=t[id].lazy;
t[id].lazy=0;
t[id].sum=t[ls].sum+t[rs].sum;
}
signed main(){
return 0;
}
反正马蜂就很抽象
感觉脑袋尖尖的