#include #include using namespace std; const int maxn=300010; const int SIZE=4096; int n,m,u,L,R,v,p,A[maxn],block[maxn/SIZE+1][SIZE]; void init() { scanf("%d%d%d",&n,&m,&u); int b=0,j=0; for(int i=0;iold) while(posB[pos+1]) { swap(B[pos+1],B[pos]); pos++; } else while(pos>0&&B[pos]