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
#include <cstdio>

int main() {

    int n, t;
    scanf ("%d %d",&n, &t);
    int n2;
    n2 = 1<<n;
    if (t%2 ==1){
        int* tab;
        tab = new int[n2];
        for(int i=0; i<n2; i++){
            scanf("%d", &tab[i]);
        }
        for(int i=n2-1; i>=0; i--){
            printf("%d ", tab[i]);
        }
        delete[] tab;
    }else{
        int y;
        for(int i=0; i<n2; i++){
            scanf("%d", &y);
            printf("%d ",y);
        }
    }

    return 0;
}