最簡單的做法
#define CBA now->judge()==now->pre->judge()?rotate(now->pre):rotate(now);
#define CB9 node::update(){sum=son[1]->sum+son[0]->sum+data;}
#define CB8 !(pre->son[1]==this||pre->son[0]==this);
#define CB7 *father=now->pre,*grandfa=father->pre;
#define CB6 now->pre=now->son[1]=now->son[0]=lct;
#define CB5 grandfa->setson(now,father->judge());
#define CB4 for(;now!=lct;last=now,now=now->pre)
#define CB3 father->pushdown();now->pushdown();
#define CB2 father->setson(now->son[lr^1],lr);
#define CB1 for(;!now->isroot();rotate(now))
#define CB0 father->update();now->update();
#define CAF printf("%d\n",query(A,B));
#define CAE if(this==lct||!rev)return;
#define CAD now->setson(father,lr^1);
#define CAC if(now->isroot())return;
#define CAB if(!now->pre->isroot())
#define CAA x->son[1]=y->pre=lct;
#define CA9 if(!father->isroot())
#define CA8 swap(son[0],son[1]);
#define CA7 scanf("%d%d",&a,&b);
#define CA6 node::judge(){return
#define CA5 access(now)->rev^=1;
#define CA4 grandfa->pushdown();
#define CA3 if(father->isroot())
#define CA2 now->setson(last,1);
#define CA1 pre->son[1]==this;}
#define CA0 if(pre==lct)return
#define C9F grandfa->update();
#define C9E now->pre=grandfa;
#define C9D node::setson(node
#define C9C this->pushdown();
#define C9B child->pre=this;
#define C9A node::pushdown()
#define C99 if(grandfa!=lct)
#define C98 lr=now->judge();
#define C97 changeroot(node
#define C96 this->update();
#define C95 son[0]->rev^=1;
#define C94 son[1]->rev^=1;
#define C93 *now=access(y);
#define C92 changeroot(x);
#define C91 node::isroot()
#define C90 x->pushdown();
#define C8F son[lr]=child;
#define C8E connect(A,B);
#define C8D *son[2],*pre;
#define C8C *A=getnew(a);
#define C8B *B=getnew(b);
#define C8A data,rev,sum;
#define C89 ___0xffff___
#define C88 x->update();
#define C87 *access(node
#define C86 now->data=x;
#define C85 connect(node
#define C84 *getnew(int
#define C83 splay(now);
#define C82 setson(node
#define C81 rotate(node
#define C80 now->sum=0;
#define C7F now->rev=0;
#define C7E pushdown();
#define C7D splay(node
#define C7C }lct[233];
#define C7B access(x);
#define C7A 0x64bfbe7d
#define C79 access(y);
#define C78 0x652895f1
#define C77 *child,int
#define C76 *last=lct;
#define C75 query(node
#define C74 now->sum;
#define C73 isroot();
#define C72 namespace
#define C71 *now=lct+
#define C70 update();
#define C6F x->pre=y;
#define C6E splay(x);
#define C6D cut(A,B);
#define C6C judge();
#define C6B top,a,b;
#define C6A cut(node
#define C69 *x,node
#define C68 rev=0;
#define C67 return
#define C66 printf
#define C65 ++top;
#define C64 struct
#define C63 *now)
#define C62 last;
#define C61 using
#define C60 true;
#define C5F "%s"
#define C5E "\n"
#define C5D 0x74
#define C5C time
#define C5B void
#define C5A 0x73
#define C59 0x70
#define C58 0x6f
#define C57 0x20
#define C56 0x23
#define C55 0x2d
#define C54 0x2e
#define C53 0x2f
#define C52 0x3a
#define C51 0x61
#define C50 0x62
#define C4F 0x63
#define C4E 0x64
#define C4D 0x65
#define C4C 0x66
#define C4B 0x68
#define C4A 0x6d
#define C49 char
#define C48 else
#define C47 0xfd
#define C46 0xfa
#define C45 0xf7
#define C44 0xd3
#define C43 0xeb
#define C42 0xe8
#define C41 0xe7
#define C40 0xdf
#define C3F 0xde
#define C3E 0xda
#define C3D 0xd7
#define C3C 0xd5
#define C3B 0xd4
#define C3A 0xf8
#define C39 lr);
#define C38 0xd2
#define C37 main
#define C36 node
#define C35 0xd1
#define C34 0xd0
#define C33 0xcf
#define C32 0xce
#define C31 0xcc
#define C30 0xcb
#define C2F 0xca
#define C2E 0xc8
#define C2D 0xc7
#define C2C 0xc6
#define C2B 0xc3
#define C2A 0xc2
#define C29 0xc1
#define C28 now;
#define C27 0xbc
#define C26 0xb9
#define C25 0xb7
#define C24 0xb5
#define C23 0xb4
#define C22 0xb1
#define C21 0xaa
#define C20 0xa8
#define C1F bool
#define C1E 0xa7
#define C1D std;
#define C1C 0x78
#define C1B *y)
#define C1A lr)
#define C19 0x0
#define C18 0xa
#define C17 int
#define C16 &&
#define C15 ()
#define C14 d,
#define C13 0;
#define C12 if
#define C11 x)
#define C10 (
#define CF )
#define CE ,
#define CD e
#define CC b
#define CB =
#define CA >
#define C9 d
#define C8 [
#define C7 ]
#define C6 a
#define C5 ;
#define C4 0
#define C3 <
#define C2 {
#define C1 }
#define C0 c
#include <time.h>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cstring>
#define CBB C61 C72 C1D C64 C36 C2 C17 C8A C36 C8D
#define CBC C1F C6C C1F C73 C5B C7E C5B C70 C5B C82
#define CBD C77 C39 C7C C17 C6B C36 C84 C11 C2 C36
#define CBE C71 C65 C86 CB6 C80 C7F C67 C28 C1 C1F
#define CBF CA6 CA1 C1F C91 C2 CA0 C60 C67 CB8 C1
#define CC0 C5B C9A C2 CAE CA8 C95 C94 C68 C1 C5B
#define CC1 CB9 C5B C9D C77 C1A C2 C9C C9B C8F C96
#define CC2 C1 C5B C81 C63 C2 C36 CB7 CA9 CA4 CB3
#define CC3 C17 C98 CB2 CA3 C9E C48 CB5 CAD CB0 C99
#define CC4 C9F C1 C5B C7D C63 C2 CAC CB1 CAB CBA
#define CC5 C1 C36 C87 C63 C2 C36 C76 CB4 C2 C83
#define CC6 CA2 C1 C67 C62 C1 C5B C97 C63 C2 CA5
#define CC7 C83 C1 C5B C85 C69 C1B C2 C92 C6F C7B
#define CC8 C1 C5B C6A C69 C1B C2 C92 C79 C6E C90
#define CC9 CAA C88 C1 C17 C75 C69 C1B C2 C92 C36
#define CCA C93 C67 C74 C1 C17 C89 C15 C2 CA7 C36
#define CCB C8C C36 C8B C8E C6D C8E CAF C67 C13 C1
#define CCC C17 C37 C10 CF C2 C12 C10 C5C C10 C4
#define CCD CF CA C7A C16 C5C C10 C4 CF C3 C78
#define CCE CF C2 C89 C10 CF C5 C1 C48 C2 C49
#define CCF C6 C8 C7 CB C2 C10 C49 CF C56 CE
#define CD0 C10 C49 CF C57 CE C10 C49 CF C23 CE
#define CD1 C10 C49 CF C46 CE C10 C49 CF C2A CE
#define CD2 C10 C49 CF C43 CE C10 C49 CF C2F CE
#define CD3 C10 C49 CF C22 CE C10 C49 CF C34 CE
#define CD4 C10 C49 CF C1E CE C10 C49 CF C26 CE
#define CD5 C10 C49 CF C47 CE C10 C49 CF C2C CE
#define CD6 C10 C49 CF C3E CE C10 C49 CF C38 CE
#define CD7 C10 C49 CF C35 CE C10 C49 CF C32 CE
#define CD8 C10 C49 CF C3F CE C10 C49 CF C25 CE
#define CD9 C10 C49 CF C20 CE C10 C49 CF C3B CE
#define CDA C10 C49 CF C30 CE C10 C49 CF C34 CE
#define CDB C10 C49 CF C34 CE C10 C49 CF C57 CE
#define CDC C10 C49 CF C56 CE C10 C49 CF C19 C1
#define CDD C5 C49 CC C8 C7 CB C2 C10 C49 CF
#define CDE C56 CE C10 C49 CF C57 CE C10 C49 CF
#define CDF C2E CE C10 C49 CF C41 CE C10 C49 CF
#define CE0 C34 CE C10 C49 CF C42 CE C10 C49 CF
#define CE1 C27 CE C10 C49 CF C31 CE C10 C49 CF
#define CE2 C34 CE C10 C49 CF C3A CE C10 C49 CF
#define CE3 C2F CE C10 C49 CF C26 CE C10 C49 CF
#define CE4 C44 CE C10 C49 CF C2B CE C10 C49 CF
#define CE5 C2D CE C10 C49 CF C43 CE C10 C49 CF
#define CE6 C29 CE C10 C49 CF C21 CE C10 C49 CF
#define CE7 C33 CE C10 C49 CF C24 CE C10 C49 CF
#define CE8 C3D CE C10 C49 CF C45 CE C10 C49 CF
#define CE9 C3C CE C10 C49 CF C40 CE C10 C49 CF
#define CEA C57 CE C10 C49 CF C56 CE C10 C49 CF
#define CEB C19 C1 C5 C49 C0 C8 C7 CB C2 C10
#define CFB C49 CF C55 CE C10 C49 CF C55 CE C10
#define CED C49 CF C57 CE C10 C49 CF C4B CE C10
#define CEE C49 CF C5D CE C10 C49 CF C5D CE C10
#define CEF C49 CF C59 CE C10 C49 CF C5A CE C10
#define CF0 C49 CF C52 CE C10 C49 CF C53 CE C10
#define CF1 C49 CF C53 CE C10 C49 CF C4F CE C10
#define CF2 C49 CF C58 CE C10 C49 CF C4E CE C10
#define CF3 C49 CF C4D CE C10 C49 CF C4C CE C10
#define CF4 C49 CF C58 CE C10 C49 CF C1C CE C10
#define CF5 C49 CF C54 CE C10 C49 CF C5D CE C10
#define CF6 C49 CF C51 CE C10 C49 CF C58 CE C10
#define CF7 C49 CF C50 CE C10 C49 CF C51 CE C10
#define CF8 C49 CF C58 CE C10 C49 CF C54 CE C10
#define CF9 C49 CF C4F CE C10 C49 CF C58 CE C10
#define CFA C49 CF C4A CE C10 C49 CF C57 CE C10
#define CFB C49 CF C55 CE C10 C49 CF C55 CE C10
#define CFC C49 CF C18 CE C10 C49 CF C19 C1 C5
#define CFD C49 C9 C8 C7 CB C5F C5 C49 CD C8
#define CFE C7 CB C5E C5 C66 C10 C14 C6 CF C5
#define CFF C66 C10 CD CF C5 C66 C10 C14 CC CF
#define C100 C5 C66 C10 CD CF C5 C66 C10 C14 C0
#define C101 CF C5 C1 C67 C13 C1
#define C102 CBB CBC CBD CBE CBF CC0 CC1 CC2 CC3 CC4
#define C103 CC5 CC6 CC7 CC8 CC9 CCA CCB CCC CCD CCE
#define C104 CCF CD0 CD1 CD2 CD3 CD4 CD5 CD6 CD7 CD8
#define C105 CD9 CDA CDB CDC CDD CDE CDF CE0 CE1 CE2
#define C106 CE3 CE4 CE5 CE6 CE7 CE8 CE9 CEA CEB CFB
#define C107 CED CEE CEF CF0 CF1 CF2 CF3 CF4 CF5 CF6
#define C108 CF7 CF8 CF9 CFA CFB CFC CFD CFE CFF C100
#define C109 C101
#define C10A C102 C103 C104 C105 C106 C107 C108 C109
#define C10B(__FOX__) __FOX__
C10B(C10A)
標(biāo)簽: