// Zadanie: Tasowanie [B] // Autor: Arkadiusz Roussau #include <iostream> #include <cstdio> using namespace std; const int P2 = 1048578; int n, t, p = 1, cards[P2], val; int main() { scanf("%d %d", &n, &t); p <<= n; for (int i = 1; i <= p; ++i) { scanf("%d", &val); cards[i] = val; } if ((t % 2) == 1) { for (int i = p; i >= 1; --i) { printf("%d ", cards[i]); } } else { for (int i = 1; i <= p; ++i) { printf("%d ", cards[i]); } } 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 33 | // Zadanie: Tasowanie [B] // Autor: Arkadiusz Roussau #include <iostream> #include <cstdio> using namespace std; const int P2 = 1048578; int n, t, p = 1, cards[P2], val; int main() { scanf("%d %d", &n, &t); p <<= n; for (int i = 1; i <= p; ++i) { scanf("%d", &val); cards[i] = val; } if ((t % 2) == 1) { for (int i = p; i >= 1; --i) { printf("%d ", cards[i]); } } else { for (int i = 1; i <= p; ++i) { printf("%d ", cards[i]); } } return 0; } |