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 <cmath>

using namespace std;

int main()
{
	std::ios_base::sync_with_stdio(0);
	long n, t, a;
	cin >> n >> t;
	//cout << "n:" << n << " " << "t:"<< t << endl;
	
	if (t % 2 == 0)
	{
		while (cin >> a)
		{
			cout << a << " ";
		}
	}
	else
	{
		long i, ilosc_elem;
		ilosc_elem = pow(2,n);
		long * liczby = new  long [ilosc_elem];
		for (long i=0;i<ilosc_elem;i++)
		{
			cin >> a;
			liczby[i] = a;
		}
		for (long i=(ilosc_elem-1);i>=0;i--)
		{
			cout << liczby[i] << " ";
		}
		delete liczby;
	}

	return 0;
}