(define (cb-tree l r) (reverse (let helper ([l l] [r r] [ls '()]) (let ([m (quotient (+ l r) 2)]) (cond [(= l r) (cons m ls)] [else (helper (+ m 1) r (helper l (- m 1) (cons m ls)))]))))) (define (main args) (let ([k (read)]) (print (let* ([cbt (cb-tree 1 (- (expt 2 k) 1))] [pcbt (cons (cadr cbt) (cons (car cbt) (cddr cbt)))]) (string-join (map number->string pcbt) " ")))) 0)