#include <cstdio> #include <cstdint> #include <vector> #include <cmath> int main() { uint32_t n, t; std::vector<uint32_t> talia; scanf("%d %d\n", &n, &t); uint32_t nn = pow(2, n); for (size_t i = 0; i < nn; ++i) { int v; scanf("%d", &v); talia.push_back(v); } if (t % 2) { for (int i = nn-1; i >= 0; --i) printf("%d ", talia[i]); } else { for (int i = 0; i < nn; ++i) printf("%d ", talia[i]); } printf("\n"); return 0; }
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 | #include <cstdio> #include <cstdint> #include <vector> #include <cmath> int main() { uint32_t n, t; std::vector<uint32_t> talia; scanf("%d %d\n", &n, &t); uint32_t nn = pow(2, n); for (size_t i = 0; i < nn; ++i) { int v; scanf("%d", &v); talia.push_back(v); } if (t % 2) { for (int i = nn-1; i >= 0; --i) printf("%d ", talia[i]); } else { for (int i = 0; i < nn; ++i) printf("%d ", talia[i]); } printf("\n"); return 0; } |