#include<cstdio> long long int tab[1050000]; main() { int n, cardsCount = 1; long long int t; scanf("%d %lld", &n, &t); while(n > 0) { cardsCount <<= 1; n--; } for(int i = 0; i < cardsCount; i++) { long long int a; scanf("%lld", &a); tab[i] = a; } if(t & 1) { for(int i = cardsCount - 1; i >= 0; --i) { printf("%lld ", tab[i]); } } else { for(int i = 0; i < cardsCount; i++) { printf("%lld ", tab[i]); } } printf("\n"); }
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 34 35 36 | #include<cstdio> long long int tab[1050000]; main() { int n, cardsCount = 1; long long int t; scanf("%d %lld", &n, &t); while(n > 0) { cardsCount <<= 1; n--; } for(int i = 0; i < cardsCount; i++) { long long int a; scanf("%lld", &a); tab[i] = a; } if(t & 1) { for(int i = cardsCount - 1; i >= 0; --i) { printf("%lld ", tab[i]); } } else { for(int i = 0; i < cardsCount; i++) { printf("%lld ", tab[i]); } } printf("\n"); } |