1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include<cstdio>
#include<memory>
int main()
{
	unsigned char n;
	unsigned t;
	std::scanf("%hhu%u", &n, &t);
	if(t%2==0)
		for (unsigned i = 0; i != 1U << n; ++i)
		{
			unsigned x;
			std::scanf("%u", &x);
			std::printf("%u ", x);
		}
	else
	{
		std::unique_ptr<unsigned[]>A(new unsigned[1U << n]);
		for (unsigned i = 0; i != 1U << n; ++i)
			std::scanf("%u", &A[i]);
		for (unsigned i = 1U << n; i != 0; --i)
			std::printf("%u ", A[i - 1]);
	}
	std::putchar(' ');
}