#pragma GCC optimize("Ofast") #pragma GCC target("avx2") #define rd() ({long _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;}) #define wt(v) {ulong _z=v;do*--wp=_z%10+48;while(_z/=10);} #define rep(v,e) for(long v=0;v=0) dame(); u=~v[t]; } if(u>=0&&!x[u]){ a[u]=t; } else{ if(u>=0){ --x[u]; } q[qw++&0x3ffff]=~u; } } if(qr!=qw) dame(); } { char*wp=wbuf+sizeof wbuf; rrep(i,n){ *--wp=' '; unsigned v=a[i]; if(v>=10000){ wp-=4; *(unsigned*)wp=wd[v%10000]; v/=10000; } wp-=4; *(unsigned*)wp=wd[v]; wp+=wdlz[v]; } write(1,wp,wbuf+sizeof wbuf-wp); } _exit(0); }