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
38
#include <iostream>
#include <stdint.h>

using namespace std;

int main()
{
	iostream::sync_with_stdio(false);
	cin.tie(NULL);
	uint32_t n, t;
	cin >> n >> t;
	if (t % 2 == 0)
	{
		uint32_t a;
		for (uint32_t i = 0; i < n-1; ++i)
		{
			cin >> a;
			cout << a << " ";
		}
		cin >> a;
		cout << a << endl;
	}
	else
	{
		n = 1u << n;
		uint32_t* a = new uint32_t[n];
		for (uint32_t i = 0; i < n; ++i)
		{
			cin >> a[i];
		}
		for (uint32_t i = n - 1; i > 0; --i)
		{
			cout << a[i] << " ";
		}
		cout << a[0] << endl;
		delete[] a;
	}
}