#include <bits/stdc++.h>
#include <stdint.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
#ifndef LOCAL_TESTS
cin.tie(NULL);
#endif
int n, t;
cin >> n >> t;
int k = (1 << n);
if(t % 2 == 0) {
for(int i = 0; i < k; ++i) {
string a;
cin >> a;
cout << a << ' ';
}
} else {
vector<string> A(k);
for(int i = 0; i < k; ++i) cin >> A[i];
for(int i = k; i --> 0;) cout << A[i] << ' ';
}
cout << '\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 | #include <bits/stdc++.h> #include <stdint.h> using namespace std; int main() { ios_base::sync_with_stdio(false); #ifndef LOCAL_TESTS cin.tie(NULL); #endif int n, t; cin >> n >> t; int k = (1 << n); if(t % 2 == 0) { for(int i = 0; i < k; ++i) { string a; cin >> a; cout << a << ' '; } } else { vector<string> A(k); for(int i = 0; i < k; ++i) cin >> A[i]; for(int i = k; i --> 0;) cout << A[i] << ' '; } cout << '\n'; return 0; } |
English