1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
#include <cstdio>
#include <algorithm>
using namespace std;
int t[2000006];
int main ()
{
int n, k;
scanf ("%d%d", &n, &k);
n=1<<n;
for (int i=1; i<=n; i++)
	scanf ("%d", &t[i]);
if (k%2==1)
	reverse(t+1, t+n+1);
for (int i=1; i<=n; i++)
	printf ("%d ", t[i]);
getchar (); getchar ();
return 0;
}