1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#include <bits/stdc++.h>
int n, t;
int talia[1048580], pot[21]={1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576}; 
int main(int argc, const char *argv[])
{
    scanf("%d%d", &n, &t);
    for( int i=1; i<=pot[n]; ++i )
        scanf("%d", &talia[t%2 ? (pot[n]-i+1) : i]);
    for( int i=1; i<=pot[n]; ++i )
        printf("%d ", talia[i]);
    printf("\n");
    return 0;
}