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
#include<iostream>
#include<cstdio>
#include<cmath>

using namespace std;
typedef unsigned long long int ull;

int main() {

  int n, t; cin >> n; cin >> t;
  ull n2 = pow(2,n);
  if (t % 2 == 0) {
    int a; for (ull i = 0;i < n2; i++) {
      cin >> a; cout << a << " ";
    }
    cout << endl;
  } else {
    int tab[n2]; 
    for (ull i = 0;i < n2; i++) cin >> tab[i];
    for (ull i = n2-1; i >=0; i--) {
      cout << tab[i] << " ";
      if (i == 0) break;
    }
    cout << endl;

  }

  return 0;
}