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
//Patryk Kisielewski - PA 2016 - Tasowanie B [TAS] - v1.0
#include <cstdio>

int main(){
    const int power[] = { 0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576 };

    int n;
    scanf("%d", &n);

    int x = power[n];

    int t;
    scanf("%d", &t);

    if(t&1){
        int st[x];
        for(int i = 0; i < x; ++i){
            scanf("%d", &st[i]);
        }
        for(int i = x-1; i >= 0; --i){
            printf("%d ", st[i]);
        }
    } else {
        int tmp;
        for(int i = 0; i < x; ++i){
            scanf("%d", &tmp);
            printf("%d ", tmp);
        }
    }
    return 0;
}