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

using std::ios_base;

int main()
{
  ios_base::sync_with_stdio(false);
  int tab[2000000];
  int n;
  int t;
  scanf("%d%d", &n, &t);
  n = (int) pow(2, n);
  for (int i = 0; i < n; i++)
    scanf("%d", tab + i);

  if (t % 2)
    while (n--)
      printf("%d ", tab[n]);
  else
    for (int i = 0; i < n; i++)
      printf("%d ", tab[i]);
  printf("\n");

  return 0;
}