#include <iostream>
int main(void) {
std::ios::sync_with_stdio(false);
long n, t;
std::cin >> n >> t;
if (t % 2 == 0) {
const long p = (n <= 0) ? 1 : (2 << (n - 1));
long x;
for (long i = 0; i < p - 1; ++i) {
std::cin >> x;
std::cout << x << " ";
}
std::cin >> x;
std::cout << x << std::endl;
}
else {
const long p = (n <= 0) ? 1 : (2 << (n - 1));
long x[p];
for (long i = 0; i < p; ++i) {
std::cin >> x[i];
}
for (long i = p - 1; i > 0; --i) {
std::cout << x[i] << " ";
}
std::cout << x[0] << std::endl;
}
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 <iostream> int main(void) { std::ios::sync_with_stdio(false); long n, t; std::cin >> n >> t; if (t % 2 == 0) { const long p = (n <= 0) ? 1 : (2 << (n - 1)); long x; for (long i = 0; i < p - 1; ++i) { std::cin >> x; std::cout << x << " "; } std::cin >> x; std::cout << x << std::endl; } else { const long p = (n <= 0) ? 1 : (2 << (n - 1)); long x[p]; for (long i = 0; i < p; ++i) { std::cin >> x[i]; } for (long i = p - 1; i > 0; --i) { std::cout << x[i] << " "; } std::cout << x[0] << std::endl; } return 0; } |
English