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
39
40
41
#include <iostream>
#include <cstring>
#include <cstdio>

using namespace std;

typedef unsigned long u32_t;

static const u32_t MAX_CARD_NUM = 0x100000;

static u32_t gCards[MAX_CARD_NUM];

int main ()
{
	u32_t n, t, nCard = 1, i;

	cin >> n >> t;
	nCard <<= n;

	if((t & 1) == 0)
	{
		u32_t a;
		for(i = 0; i < nCard; ++ i)
		{
			cin >> a;
			cout << a << " ";
		}
	}
	else
	{
		for(i = 0; i < nCard; ++ i)
		{
			cin >> gCards[i];
		}
		for(i = 0; i < nCard; ++ i)
		{
			cout << gCards[nCard-i-1] << " ";
		}
	}
	return 0;
}