int z=Get_Kth(root,c+1);
Splay(z,0);
int m=Get_Min(ch[root][1]);
Splay(m,root);
Key_value=tmp;
pre[Key_value]=ch[root][1];
Push_Up(ch[root][1]);
Push_Up(root);
} www.2cto.com
int cnt;
void InOrder(int r){
if(r==0)
return;
Push_Down(r);
InOrder(ch[r][0]);
if(cnt>=1&&cnt<=n){
if(cnt>1) printf(" ");
printf("%d",key[r]);
}
cnt++;
InOrder(ch[r][1]);
}
int main(){
if(n==-1&&q==-1)
break;
Init();
while(q--){
char str[10];
int a,b,c;
scanf("%s",str);
if(str[0]=='C'){
scanf("%d%d%d",&a,&b,&c);
Cut(a,b,c);
}
else{
scanf("%d%d",&a,&b);
Reversal(a,b);
}
}
cnt=0;
InOrder(root);
printf("\n");
}
return 0;
}
作者:ACM_cxlove