#include #include #include #include "x.h" typedef struct{int L; int R;} pair; #define P 0 #define sz (1<<20) int fr[sz]; pair A[3*sz]; int Andx = 0; static int bt(int fst, int lst){assert(Andx<3*sz && fst<=lst); if(fst==lst) return fr[fst]; int y = arc4random_uniform(lst-fst); pair p = (pair){bt(fst, fst+y), bt(fst+y+1, lst)}; A[Andx] = p; return Andx++;} static void scan(int root, sp x){if(root<0) PutGet(root, x); else {pair p = A[root]; scan(p.L, x); scan(p.R, x);}} void startR(int n, sp * s){PutGet(0, s); scan(n, s); PutGet(1, s); exit(printf("Should not be here yet.\n"));}; static int ef(int X, int Y){sp other1, other2; begin(X, &other1); begin(Y, &other2); if(1) for(int j = 0; j