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
#include <cstdio>
#include <algorithm>

using namespace std;

int main()
{
	unsigned n, t, v, iters;
	scanf("%u %u", &n, &t);
	iters = 1 << n;
	if (t % 2 == 0)
	{
		while (iters--)
		{
			scanf("%u", &v);
			printf("%u ", v);
		}
	}
	else
	{
		unsigned* data = new unsigned[iters];
		for(unsigned i = 0; i < iters; ++i)
			scanf("%u", &data[i]);

		for(unsigned i = iters; i > 0; --i)
			printf("%u ", data[i - 1]);
	}

	return 0;
}