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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <iostream>

using namespace std;

unsigned long long int tab[1048576];

int main()
{
  std::ios_base::sync_with_stdio(false);

  unsigned long long t;
  unsigned int n;
  unsigned long long counter = 1;
  unsigned long long number;

  cin >> n >> t;

  counter <<= n;

  //cout << "counter = " << counter << "\n";

  if(t % 2 == 0)
  {
    for(unsigned long long i = 0; i < counter; i++)
    {
      cin >> number;
      cout << number << " ";
    }

    cout << "\n";
    return 0;
  }
  //cout << "counter = " << counter << "\n";
  for(unsigned long long i = 0; i < counter; i++)
  {
    cin >> number;
    tab[counter - 1 - i] = number;
  }

  for(unsigned long long i = 0; i < counter; i++)
  {
    cout << tab[i] << " ";
  }

  cout << "\n";
  return 0;





  return 0;
}