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
#include <cstdio>
using namespace std;

int main()
{
	long T[1100001];
	long t;
	int il=1, n;
	scanf("%d %ld", &n, &t);
	for(long long  i=1;i <= n;i++,il*=2);
	for (int i=0; i < il; i++)
	{
		scanf("%d", T +i);
	}
	if (t&1 == 1)
	{
		for (long i = il-1; i > -1; i--)
		printf("%d ", T[i]);
	}
	else
	{
		for (long i=0; i <il;++i)
		printf("%d ", T[i]);
	}
	return 0;
}