BZOJ- 1036: [ZJOI2008]树的统计Count(LCT代码)

#include 

#include 

#include 

#include 

 

using namespace std;

 

#define MAXN 30001

#define L(t) left[t]

#define R(t) right[t]

#define F(t) father[t]

#define G(t) father[father[t]]

#define IN(t) Information[t]

#define S(t)IN(t).Sum

#define M(t)IN(t).Max

#define V(t) Value[t]

#define P(t) path_parent[t]

#define Cl(t)(L(F(t))==t)

#define inf 0x7fffffff

#define Parent(v)P(splay_roof(v))

 

struct edge{

    edge *next;

    int t;

    edge (){

        next=NULL;

    }

}*head[MAXN];

int n,m,V=0,w[MAXN];

 

void Add(int s,int t){

    edge *p=new(edge);

    p->t=t,p->next=head[s];

    head[s]=p;

}

 

void AddEdge(int s,int t){

    Add(s,t),Add(t,s);

}

 

void Build_Tree(){

    memset(head,0,sizeof(head));

    scanf("%d",&n);

    for(int i=0;i++next){

        if(f[p->t])P(p->t)=v,Dfs(p->t);

    }

}

 

void Init_lct(){

    memset(f,true,sizeof(f));

    memset(father,0,sizeof(father));

    memset(left,0,sizeof(left));

    memset(right,0,sizeof(right));

    memset(path_parent,0,sizeof(path_parent));

    P(1)=0,Dfs(1);

    for(int i=0;i++

你可能感兴趣的:(BZOJ- 1036: [ZJOI2008]树的统计Count(LCT代码))