// PA2016, runda 1, Tasowanie // Andrzej Pezarski #include <cstdio> #include <cstdlib> #include <vector> #include <algorithm> using namespace std; int main() { int n, t; scanf("%d%d", &n, &t); vector<int> v(1<<n); for (auto &x:v) scanf("%d", &x); if (t%2) reverse(v.begin(), v.end()); for (auto &x:v) printf("%d ", x); 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 | // PA2016, runda 1, Tasowanie // Andrzej Pezarski #include <cstdio> #include <cstdlib> #include <vector> #include <algorithm> using namespace std; int main() { int n, t; scanf("%d%d", &n, &t); vector<int> v(1<<n); for (auto &x:v) scanf("%d", &x); if (t%2) reverse(v.begin(), v.end()); for (auto &x:v) printf("%d ", x); printf("\n"); return 0; } |