#include <cstdlib> #include <stdio.h> #include <iostream> #include <vector> #include <iterator> int main() { long n,t,l; std::cin >> n >> t; std::vector<int> dane(1<<n); for (int i=0;i<(1<<n);i++) std::cin >> dane[i]; for (int i=0;i<(1<<n);i++) std::cout << dane[ t%2==0?i:(1<<n)-i-1] << " "; return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #include <cstdlib> #include <stdio.h> #include <iostream> #include <vector> #include <iterator> int main() { long n,t,l; std::cin >> n >> t; std::vector<int> dane(1<<n); for (int i=0;i<(1<<n);i++) std::cin >> dane[i]; for (int i=0;i<(1<<n);i++) std::cout << dane[ t%2==0?i:(1<<n)-i-1] << " "; return 0; } |