#858
Gold II
JOGURT
채점 준비중
시간 제한
1s
메모리 제한
32MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

A complete binary tree is made of nodes arranged in a hierarchic structure. One of the nodes is the root node, said to be at level 0. The root node has two child nodes, which are at level 1. Each of those has two children at level 2 etc.

In general, a complete binary tree with NN levels has 2N12^N - 1 nodes, each of which has two child nodes, except those at level L1L-1.

A number can be written into each node. Write the numbers 11 to 2N12^N - 1 into a complete binary tree with NN levels so that, for each node at level DD, the absolute value of the difference of the sum of all numbers in the left subtree and the sum of all numbers in the right subtree is 2D2^D.

For example, the sum of the left subtree of the root node must differ from the sum of the right subtree by 11. The sums of the left and right subtrees of a node at level 11 must differ by 22.

Each number must be used exactly once. The solution need not be unique.

입력

The first and only line of input contains the integer NN (1N151 \le N \le 15), the number of levels in the tree.

출력

Output the 2N12^N - 1 separated by spaces on a single line, the binary tree in the preorder traversal. The preorder traversal first outputs the number in the root node, then outputs the left subtree (again in the preorder traversal), then the right subtree.

예제 입력 1

2

예제 출력 1

3

예제 입력 2

3 1 2

예제 출력 2

3 1 7 5 6 2 4
코드 제출

이 문제는 현재 제출할 수 없습니다.

이 현상이 잘못되었다고 생각될 경우 관리자한테 문의주세요.

내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Gold II1명 투표· 약 1개월 전
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.