1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
#include <cstdio>
main() {
	int n, t;
	scanf("%d %d\n", &n, &t);
	n = 1 << n;
	t %= 2;
	int* seq = new int[n];
	for (int i = 0; i < n; ++i)
		scanf("%d", &seq[i]);
	for (int i = 0; i < n; ++i)
		printf("%d ", seq[i + t * (n - 2 * i - 1)]);
	delete[] seq;
	return 0;
}