欢迎光临
我们一直在努力

PLCT检查是什么P2147 [SDOI2008]洞穴勘测 (LCT)

  1 #include"bits/stdc++.h"
  2 #define I inline
  3 using namespace std;
  4 int n,m;
  5 const int N = 1e5+10;
  6 
  7 int ch[N][2]; int fa[N];
  8 int r[N];
  9 int st[N];
 10 
 11 inline void pushr(int x)
 12 {
 13     swap(ch[x][0],ch[x][1]);
 14     r[x]^=1;
 15 }
 16 inline void pushdown(int x)
 17 
 24 }
 25 I int pushup(int x){};
 26 inline int nroot(int x)
 27 {
 28     return ch[fa[x]][0]==x||ch[fa[x]][1]==x;
 29 }
 30 inline void rot(int x)
 31 
 39 inline void splay(int x)
 40 
 53 }
 54 inline void access(int x)
 55 {
 56     for(int y=0;x;x=fa[y=x])
 57         splay(x),ch[x][1]=y,pushup(x);
 58 }
 59 I int makeroot(int x)
 60 {
 61     access(x);splay(x);pushr(x);
 62 }
 63 I int findroot(int x)
 64 {
 65     access(x);splay(x);
 66     while(ch[x][0])pushdown(x),x=ch[x][0];
 67     splay(x);
 68     return x;
 69 }
 70 I int split(int x,int y)
 71 {
 72     makeroot(x);
 73     access(y);splay(y);
 74 }
 75 I int link(int x,int y)
 76 
 80 I int cut(int x,int y)
 81 
 87 }
 88 int main()
 89 
104     }
105 }
赞(0)
未经允许不得转载:上海聚慕医疗器械有限公司 » PLCT检查是什么P2147 [SDOI2008]洞穴勘测 (LCT)

登录

找回密码

注册