#include <iostream> #include <cstdio> unsigned int tab[(1<<20)]; int main(){ std::ios_base::sync_with_stdio(false); unsigned int n = 0, t = 0; std::cin>>n>>t; t = t % 2; int total = (1<<n); for(int i = 0 ; i < total; i++){ tab[i] = 0; std::cin>>tab[i]; } for(int i = 0; i < total; i++){ std::cout<< tab[(t == 1 ? (total - i - 1) : i)]<<" "; } return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #include <iostream> #include <cstdio> unsigned int tab[(1<<20)]; int main(){ std::ios_base::sync_with_stdio(false); unsigned int n = 0, t = 0; std::cin>>n>>t; t = t % 2; int total = (1<<n); for(int i = 0 ; i < total; i++){ tab[i] = 0; std::cin>>tab[i]; } for(int i = 0; i < total; i++){ std::cout<< tab[(t == 1 ? (total - i - 1) : i)]<<" "; } return 0; } |