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


 }