1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <iostream>
#include <cstdio>

#define MAXN 1048576

using namespace std;

int a[MAXN];

int exp2 (int i) {
	if (i==0) return 1;
	return 2*exp2(i-1);
}

int main () {
	int t, n, i;
	
	cin >> n >> t;
	n = exp2(n);	
	
	for (i=1; i<=n; i++) {
		scanf ("%d", &a[i]);
	}
	
	if (t%2==0) {
		for (i=1; i<=n; i++) {
			printf ("%d ", a[i]);
		}
	} else {
		for (i=n; i>0; i--) {
			printf ("%d ", a[i]);
		}
	}
	cout << endl;
	
	return 0;
}