#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main()
{
  iostream::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, t;
  cin >> n >> t;
  vector<int> v(1 << n);
  for (auto& x: v) {
    cin >> x;
  }
  if (t % 2 == 1) reverse(v.begin(), v.end());
  bool first = true;
  for (auto const& x: v) {
    if (!first) cout << ' ';
    cout << x;
    first = false;
  }
  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 <algorithm> #include <iostream> #include <vector> using namespace std; int main() { iostream::sync_with_stdio(false); cin.tie(nullptr); int n, t; cin >> n >> t; vector<int> v(1 << n); for (auto& x: v) { cin >> x; } if (t % 2 == 1) reverse(v.begin(), v.end()); bool first = true; for (auto const& x: v) { if (!first) cout << ' '; cout << x; first = false; } cout << '\n'; return 0; } | 
 
            
         English
                    English