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
#include<cstdio>
#include<algorithm>
using namespace std;

typedef long long LL;

#define MAXN 1048580

LL tab[MAXN];
LL n,t,ile;

int main(){
	scanf("%lld %lld",&n,&t);
	LL calc = 1;
	while (n--) {
		calc*=2;
		//printf("calc %lld\n", calc);
	}
	for(LL i=0;i<calc;i++) {
		scanf("%lld",tab+i);
	}
	if(t&1){
		for(LL i=calc-1;i>=0;i--) {
			printf("%lld ", tab[i]);
		}
	} else {
		for(LL i=0;i<calc;i++) {
			printf("%lld ", tab[i]);
		}
	}
	printf("\n");
	return 0;
}