1.注意标记冲突
如果像我一样同时维护区间是否全为空或为满,两个标记不能同时存在
2.注意区间重叠
当询问区间重叠时,前区间取出的组织会对后区间有影响
附上random.cpp
#include<bits/stdc++.h>
using namespace std;
int main(){
freopen("std.in","w",stdout);
srand(time(0));
int n=100000,m=100000;
printf("%d %d\n",n,m);
for(int i=1;i<=m;++i){
int t=rand()%3;
printf("%d ",t);
if(t==0){
int l=rand()%50000+1,k=rand()%30000;
printf("%d %d\n",l,l+k);
}
if(t==1){
int l1=rand()%50000+1,r1=rand()%50000+1;
while(l1>r1)
l1=rand()%50000+1,r1=rand()%50000+1;
int l2=rand()%50000+1+(n>>1),r2=rand()%50000+1+(n>>1);
while(l2>r2)
l2=rand()%50000+1+(n>>1),r2=rand()%50000+1+(n>>1);
if(rand()%3)swap(l2,r1);
if(rand()%2){
swap(l1,l2);swap(r1,r2);
}
printf("%d %d %d %d\n",l1,r1,l2,r2);
}
if(t==2){
int l=1+rand()%30000,r=n-rand()%30000;
printf("%d %d\n",l,r);
}
}
return 0;
}