#define _CRT_SECURE_NO_WARNINGS #include<iostream> #include<cstdio> #include<algorithm> #include<vector> #include<stack> #include<set> #include<queue> #include<map> #include<string> #include<cstring> #include<iomanip> using namespace std; int n, t, T[1000004]; int main() { scanf("%d%d", &n, &t); n = (1 << n); for (int i = 1; i <= n; i++) scanf("%d", &T[i]); if (t % 2 == 0) for (int i = 1; i <= n; i++) printf("%d ", T[i]); else for (int i = n; i >= 1; i--) printf("%d ", T[i]); getchar(); getchar(); 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 | #define _CRT_SECURE_NO_WARNINGS #include<iostream> #include<cstdio> #include<algorithm> #include<vector> #include<stack> #include<set> #include<queue> #include<map> #include<string> #include<cstring> #include<iomanip> using namespace std; int n, t, T[1000004]; int main() { scanf("%d%d", &n, &t); n = (1 << n); for (int i = 1; i <= n; i++) scanf("%d", &T[i]); if (t % 2 == 0) for (int i = 1; i <= n; i++) printf("%d ", T[i]); else for (int i = n; i >= 1; i--) printf("%d ", T[i]); getchar(); getchar(); return 0; } |